Information Technology Reference
In-Depth Information
Example of Using Documentation Comments
The following code shows the beginning of a class declaration, containing documentation
comments.
/// <summary>
/// This is class MyClass, which does the following wonderful things, using
/// the following algorithm. ... Besides those, it does these additional
/// wonderful things.
/// </summary>
class MyClass
{
/// <summary>
/// Field1 is used to hold the value of ...
/// </summary>
public int Field1 = 10;
/// <summary>
/// MyMethod is just a test method to show how the XML comments work.
/// It does no actual processing.
/// </summary>
/// <param name="In1"></param>
/// <param name="str1"></param>
/// <returns></returns>
public int MyMethod(int In1, string str1)
{
return 0;
}
When this simple code is output to an XML file and run through a document generator,
it can produce beautiful and potentially very useful documentation of the code. Figure 23-6
shows just a small sample of the output from this code by one of the readily available docu-
ment generators. This extensive documentation was produced with almost no work.
Figure 23-6. Output of a document generator
Search WWH ::




Custom Search