Tutorial
C # provides a mechanism for developers to archive their code using XML. In the source code file, the following code lines can be processed as comments and placed in the file: rows starting with //; in user-defined types (such as classes, delegates, or interfaces), a member (such as a field, event, attribute or method) or a row before a namespace declaration.
Example
The following example provides a basic overview of an archived type. To compile this example, type the following command line:
Csc XMLsample. cs/doc: XMLsample. xml
This will create the XML file XMLsample. xml, which can be viewed in a browser or by using the TYPE command.
// XMLsample. cs
// Compile with:/doc: XMLsample. xml
Using System;
/// <Summary>
/// Class level summary documentation goes here. </summary>
/// <Remarks>
/// Longer comments can be associated with a type or member
/// Through the remarks tag </remarks>
Public class SomeClass
{
/// <Summary>
/// Store for the name property </summary>
Private string myName = null;
/// <Summary>
/// The class constructor. </summary>
Public SomeClass ()
{
// TODO: Add Constructor Logic here
}
/// <Summary>
/// Name property </summary>
/// <Value>
/// A value tag is used to describe the property value </value>
Public string Name
{
Get
{
If (myName = null)
{
Throw new Exception ("Name is null ");
}
Return myName;
}
}
/// <Summary>
/// Description for SomeMethod. </summary>
/// <Param name = "s"> Parameter description for s goes here </param>
/// <Seealso cref = "String">
/// You can use the cref attribute on any tag to reference a type or member
/// And the compiler will check that the reference exists. </seealso>
Public void SomeMethod (string s)
{
}