XML Documentation
C# offers three different styles of source-code documentation: single-line comments, multiline comments, and documentation comments.
C/C++-Style Comments
Single- and multiline comments use the C++ syntax: // and /*...*/:
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 types. Consequently, it cannot 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
Documentation comments are similar to C# single-line comments, but start
with /// (that’s three slashes),
and can be applied to any user-defined type or member. As well as containing
descriptive text, these comments can also include embedded XML tags. These
tags allow one to mark up the descriptive text to better define the semantics
of the type or member, and also to incorporate cross-references.
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 XSLT, generating HTML ...