TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C# Coding Standard
Search

Rule:  8@104

Synopsis:List the explicit exceptions a method or property can throw
Language:C#
Severity Level:8
Category:Exceptions


Description:

Describe the recoverable exceptions using the <exception> tag.

Explicit exceptions are the ones that a method or property explicitly throws from its implementation and which users are allowed to catch. Exceptions thrown by .NET framework classes and methods used by this implementation do not have to be listed here.

Example:

/// <exception cref="FileNotFoundException">Thrown when somepath isn't a real file.</exception>
public void MyMethod2()
{
    FileInfo fi = new FileInfo(somepath);
    if (!fi.Exists)
    {
        throw new FileNotFoundException("somepath doesn't exist");
    }
    ...
}