Click to Rate and Give Feedback
MSDN
MSDN Library
Visual Studio 2005
Visual Studio
Visual C#
 <exception>
This page is specific to
Microsoft Visual Studio 2005/.NET Framework 2.0

Other versions are also available for the following:
C# Programming Guide
<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.

C#
// 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)
        {
        }
    }
}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Shown in IntelliSense      David M. Kean - MSFT   |   Edit   |  
IntelliSense uses the exceptions added via the <exception/> tag, as well text contained within the <summary/> tag, when displaying information about member.
Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2008 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker