<exception> (Visual Basic)

Specifies which exceptions can be thrown.

<exception cref="member">description</exception>


  • member
    A reference to an exception that is available from the current compilation environment. The compiler checks that the given exception exists and translates member to the canonical element name in the output XML. member must appear within double quotation marks (" ").

  • description
    A description.


Use the <exception> tag to specify which exceptions can be thrown. This tag is applied to a method definition.

Compile with /doc to process documentation comments to a file.


This example uses the <exception> tag to describe an exception that the IntDivide function can throw.

''' <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

See Also


Recommended XML Tags for Documentation Comments (Visual Basic)