Question

Suppose we have the following code:

/// <summary>
/// Test class comment
/// </summary>
public class Test
{
    /// <summary>
    /// Method comment
    /// </summary>
    /// <param name="a">First parameter comment</param>
    /// <param name="b">Second parameter comment</param>
    /// <returns>Return value comment</returns>
    public int Foo(int a, int b) { return 1; }
}

Where does the C# compiler store comments in assembly? If IntelliSence can use comments, I also want.

Was it helpful?

Solution

Where does the C# compiler store comments in assembly?

It doesn't.

If IntelliSence can use comments, I also want.

In that case, you need to turn on XML documentation generation in your build. (Assuming you're using Visual Studio, go to your project properties, the Build tab, Output section, "XML documentation file".

That will spit out a separate file (conventionally the name of the assembly with an extension of .xml) containing the doc comments. This will not include all comments though - only the XML documentation comments.

See the MSDN guide to C# documentation comments for more details. You might also want to look at Sandcastle Help File Builder to create web pages, CHM files etc from the comments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top