XML Documentation Comments (C# Programming Guide)

Switch View :
ScriptFree
Visual Studio 2010 - Visual C#
XML Documentation Comments (C# Programming Guide)

In Visual C# you can create documentation for your code by including XML tags in special comment fields in the source code directly before the code block they refer to. For example:

/// <summary>
///  This class performs an important function.
/// </summary>
public class MyClass{}

When you compile with /doc the compiler will search for all XML tags in the source code and create an XML documentation file. To create the final documentation based on the compiler-generated file, you can create a custom tool, or use a tool such as Sandcastle.

NoteNote

The XML doc comments are not metadata; they are not included in the compiled assembly and therefore they are not accessible through reflection.

In This Section

Related Sections

For more information, see:

C# Language Specification

For more information, see the C# Language Specification. The language specification is the definitive source for C# syntax and usage.

See Also

Concepts

Community Content

294de3557d9d00b3d2d8a1e6aab028cf
Multilingual comments?
Is it possible to document the code in more than one language?
Example <summary lang="en"> and <summary lang="sv">

R Barclay
.. and commercial tools too
I think it would be useful to link to commercial tools too - sandcastle can be a pretty steep learning curve and doesn't include any actual authoring tools. We have been using Innovasys Document! X for some time now (and I know that Infragstics does too which is a good sign) - it includes a Visual Editor to work with Xml source comments and our tech writers use it for external content and adding topics to the eventual help too. There are other commercial tools available too I'm sure.

vmikhalyov
It would be nice to mention Sandcastle at least.
It would be nice to mention here products like Sandcastle, which make HTML (and other types) help files from the XML document.