建议的文档注释标记
如果希望在文档注释的文本中显示尖括号,请使用 <
和 >
的 HTML 编码,分别为 <
和 >
。 下面的示例对此编码进行了演示。
/// <summary>
/// This property always returns a value < 1.
/// </summary>
如果希望文本需要换行显示,使用<br />
如果希望文本是一个段落,使用<para>
更多示例:
//《TestClass.cs》
using System;
using System.Collections.Generic;
using System.Text;
namespace XMLTag
{
/// <summary>
/// This is a test class
/// </summary>
/// <remarks>
/// You may have some additional information about this class.<br/>
/// There's the class diagram.<br/>
/// <img src="ClassDiagram.png" />
/// </remarks>
public class TestClass
{
/// <summary>DoWork is a method in the TestClass class.
/// <para>Here's how you could make a second paragraph in a description.<br/>
/// The <paramref name="aParam"/> parameter takes a number.<br/>
/// <see cref="TestClass.aValue"/> for information about output statements.
/// </para>
/// <seealso cref="TestClass.GetZero"/>
/// </summary>
/// <param name="aParam">Used to indicate status.</param>
/// <returns>Returns none.</returns>
public static void DoWork(int aParam)
{
// System.Console.WriteLine(System.String);
}
/// <summary>
/// The GetZero method.
/// </summary>
/// <returns>returns zero.</returns>
/// <example> This sample shows how to call the GetZero method.
/// <code>
/// class MyClass
/// {
/// static int Main()
/// {
/// return GetZero();
/// }
/// }
/// </code>
/// </example>
public static int GetZero()
{
return 0;
}
private string _value;
/// <value>The aValue property gets/sets the _value data member.
/// </value>
public string aValue
{
get
{
return _value;
}
set
{
_value = value;
}
}
}
}