Information Technology Reference
In-Depth Information
Inserting Documentation Comments
Documentation comments start with three consecutive forward slashes:
￿
The first two slashes indicate to the compiler that this is an end-of-line comment and
should be ignored in the parsing of the program.
￿
The third slash indicates that it is a documentation comment.
For example, in the following code, the first four lines show documentation comments
about the class declaration. They use the <summary> XML tag. Above the declaration of the field
are three lines documenting the field—again using the <summary> tag.
/// <summary> Open XML tag for the class.
/// This is class MyClass, which does the following wonderful things, using
/// the following algorithm. ... Besides those, it does these additional
/// wonderful things.
/// </summary> Close XML tag.
class MyClass // Class declaration
{
/// <summary> Open XML tag for the field.
/// Field1 is used to hold the value of ...
/// </summary> Close XML tag.
public int Field1 = 10; // Field declaration
...
Each XML element is inserted automatically by the Visual Studio IntelliSense feature when
you type three slashes above the declaration of a language feature, such as a class or a class
member.
For example, the following code shows two slashes above the declaration of class MyClass .
//
class MyClass
{ ...
As soon as you add the third slash, IntelliSense immediately expands the comment to the
following code, without your having to do anything. You can then type anything you want on
the documentation comment lines between the tags.
/// <summary> Automatically inserted
/// Automatically inserted
/// </summary> Automatically inserted
class MyClass
{ ...
Search WWH ::




Custom Search