Search code examples
c#.netdocumentationdocumentation-generationxml-documentation

How to use inline comments to document members in .NET?


How can I document a member inline in .Net? Let me explain. Most tools that extract documentation from comments support some kind of inline documentation where you can add a brief after the member declaration. Something like:

public static string MyField; /// <summary>Information about MyField.</summary>

Is there a way to do this in C# or the .NET languages?


Solution

  • No, you can't. XML comments are only supported as a block level comment, meaning it must be placed before the code element you are documenting. The common tools for extracting XML comments from .NET code do not understand how to parse inline comments like that. If you need this ability you will need to write your own parser.