<异常> (Visual Basic)
指定可以引发哪些异常。
语法
<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