<typeparam>(C# 编程指南)<typeparam> (C# Programming Guide)


<typeparam name="name">description</typeparam>  


类型参数的名称。The name of the type parameter. 用双引号 (" ") 将名称引起来。Enclose the name in double quotation marks (" ").

类型参数的说明。A description for the type parameter.


在泛型类型或方法声明的注释中,应使用 <typeparam> 标记来描述类型参数。The <typeparam> tag should be used in the comment for a generic type or method declaration to describe a type parameter. 为泛型类型或方法的每个类型参数添加标记。Add a tag for each type parameter of the generic type or method.

有关详细信息,请参阅泛型For more information, see Generics.

<typeparam> 标记的文本将显示在 IntelliSense、对象浏览器窗口代码注释 Web 报表。The text for the <typeparam> tag will be displayed in IntelliSense, the Object Browser Window code comment web report.

使用 /doc 进行编译可以将文档注释处理到文件中。Compile with /doc to process documentation comments to a file.


// compile with: -doc:DocFileName.xml 

/// comment for class
public class TestClass
    /// <summary>
    /// Creates a new array of arbitrary type <typeparamref name="T"/>
    /// </summary>
    /// <typeparam name="T">The element type of the array</typeparam>
    public static T[] mkArray<T>(int n)
        return new T[n];

请参阅See also