<typeparamref> (Visual Basic)

将单词的格式设置为类型参数。

Syntax

<typeparamref name="name"/>  

参数

name:要引用的类型参数的名称。 用双引号将名称括起来(“ )。

注解

标记 <typeparamref> 提供了一种指示单词是类型参数的方法。 可以处理 XML 文件以某种不同的方式格式化此类型参数,例如斜体。

使用 -doc 编译以处理对文件的文档注释。

Example

此示例使用 <typeparamref> 标记引用 T 类型参数。

''' <summary>
''' Compares two items of type <typeparamref name="T"/>.
''' </summary>
''' <typeparam name="T">The type of items to compare.</typeparam>
''' <param name="item1">The first item of type <typeparamref name="T"/>.</param>
''' <param name="item2">The second item of type <typeparamref name="T"/>.</param>
''' <returns>True if the items are equal, False otherwise.</returns>
Public Function CompareItems(Of T As IComparable)(ByVal item1 As T, ByVal item2 As T) As Boolean
    Return item1.CompareTo(item2) = 0
End Function

另请参阅