建议的文档注释标记(C# 编程指南)Recommended Tags for Documentation Comments (C# Programming Guide)

C# 编译器处理代码中的文档注释,并在文件中将其设置为 XML 格式,该文件的名称通过 /doc 命令行选项指定 。The C# compiler processes documentation comments in your code and formats them as XML in a file whose name you specify in the /doc command-line option. 若要基于编译器生成的文件创建最终文档,可以创建一个自定义工具,也可以使用 DocFXSandcastle 等工具。To create the final documentation based on the compiler-generated file, you can create a custom tool, or use a tool such as DocFX or Sandcastle.

在类型和类型成员等代码构造中处理标记。Tags are processed on code constructs such as types and type members.

备注

不可对命名空间应用文档注释。Documentation comments cannot be applied to a namespace.

编译器将处理属于有效 XML 形式的任何标记。The compiler will process any tag that is valid XML. 下列标记提供用户文档的中常用功能。The following tags provide generally used functionality in user documentation.

TagsTags

<c><c> <para><para> <see>*<see>*
<code><code> <param>*<param>* <seealso>*<seealso>*
<example><example> <paramref><paramref> <summary><summary>
<exception>*<exception>* <permission>*<permission>* <typeparam>*<typeparam>*
<include>*<include>* <remarks><remarks> <typeparamref><typeparamref>
<list><list> <returns><returns> <value><value>

(* 表示编译器验证语法。)(* denotes that the compiler verifies syntax.)

如果希望在文档注释的文本中显示尖括号,请使用 <> 的 HTML 编码,分别为 &lt;&gt;If you want angle brackets to appear in the text of a documentation comment, use the HTML encoding of < and > which is &lt; and &gt; respectively. 下面的示例对此编码进行了演示:This encoding is shown in the following example:

/// <summary>
/// This property always returns a value &lt; 1.
/// </summary>

请参阅See also