CSharp - Statement XML Documentation


A documentation comment is embedded XML comments for a type or a member.

A documentation comment comes immediately before a type or member declaration, and starts with three slashes:

/// <summary>Cancels a running query.</summary>
public void Cancel() { ... }

Multiline comments can be done either like this:

/// <summary>
/// Cancels a running query
/// </summary>
public void Cancel() { ... }

or like this (notice the extra star at the start):

<summary> Cancels a running query. </summary>
public void Cancel() { ... }

If you compile the source code with the /doc directive, the compiler extracts and collates documentation comments into a single XML file.

Third-party tools can transform the XML file into an HTML help file.