C# offers three different styles of source-code documentation: single-line comments, multiline comments, and documentation comments.
Single- and multiline
comments use the
int x = 3; // this is a comment MyMethod( ); /* this is a comment that spans two lines */
The disadvantage of this style of commenting is that there is no predetermined standard for documenting your types. Consequently, it can’t be easily parsed to automate the production of documentation. C# improves on this by allowing you to embed documentation comments in the source, and by providing an automated mechanism for extracting and validating documentation at compile time.
Documentation comments are similar to C# single-line comments but
and can be applied to any user-defined
type or member. These comments can include embedded XML tags as well
as descriptive text. These tags allow you to mark up the descriptive
text to better define the semantics of the type or member and also to
These comments can then be extracted at compile time into a separate output file containing the documentation. The compiler validates the comments for internal consistency, expands cross references into fully qualified type IDs, and outputs a well-formed XML file. Further processing is left up to you, although a common next step is to run the XML through an XSL/T, generating HTML documentation.
Here is an example ...