Export (0) Print
Expand All
1 out of 8 rated this helpful - Rate this topic

<exception> (C# Programming Guide)


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

Parameters

cref = " 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 (" ").

For more information on how to create a cref reference to a generic type, see <see> (C# Programming Guide).

description

A description of the exception.

The <exception> tag lets you specify which exceptions can be thrown. This tag can be applied to definitions for methods, properties, events, and indexers.

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

// compile with: /doc:DocFileName.xml 

/// comment for class
public class EClass : System.Exception
{
    // class definition...
}

/// comment for class
class TestClass
{
    /// <exception cref="System.Exception">Thrown when...</exception>
    public void DoSomething()
    {
        try
        {
        }
        catch (EClass)
        {
        }
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.