<exception>
documentation tag
The <exception>
tag lets you specify which exceptions can be thrown. This tag is applied to a method definition.
Syntax
/// <exception cref="member">description</exception>
Parameters
member
A reference to an exception that's available from the current compilation environment. Using name lookup rules, the compiler checks that the given exception exists, and translates member
to the canonical element name in the output XML. The compiler issues a warning if it doesn't find member
.
Enclose the name in single or double quotation marks.
For more information on how to create a cref
reference to a generic type, see <see>
.
description
A description.
Remarks
Compile with /doc
to process documentation comments to a file.
The MSVC compiler attempts to resolve cref
references in one pass through the documentation comments. If using the C++ lookup rules, when a symbol isn't found by the compiler the reference is marked as unresolved. For more information, see <seealso>
.
Example
// xml_exception_tag.cpp
// compile with: /clr /doc /LD
// post-build command: xdcmake xml_exception_tag.dll
using namespace System;
/// Text for class EClass.
public ref class EClass : public Exception {
// class definition ...
};
/// <exception cref="System.Exception">Thrown when... .</exception>
public ref class TestClass {
void Test() {
try {
}
catch(EClass^) {
}
}
};