指定可以引发哪些异常。
语法
<exception cref="member">description</exception>
参数
member
对当前编译环境中可用的异常的引用。 编译器检查是否存在给定的异常,并将 member 转换为输出 XML 中的规范的元素名称。
member 必须出现在双引号 (“ ) 内。
description
说明。
注解
使用 <exception> 标记指定可以引发哪些异常。 此标记应用于方法定义。
使用 -doc 编译以处理对文件的文档注释。
示例:
此示例使用 <exception> 标记来描述函数可以引发的 IntDivide 异常。
''' <exception cref="System.OverflowException">
''' Thrown when <paramref name="denominator"/><c> = 0</c>.
''' </exception>
Public Function IntDivide(
ByVal numerator As Integer,
ByVal denominator As Integer
) As Integer
Return numerator \ denominator
End Function