Partager via


Design Guidelines for Exceptions 

Exceptions are the standard mechanism for reporting errors. Applications and libraries should not use return codes to communicate errors. The use of exceptions adds to a consistent framework design and allows error reporting from members, such as constructors, that cannot have a return type. Exceptions also allow programs to handle the error or terminate as appropriate. The default behavior is to terminate an application if it does not handle a thrown exception. For a detailed discussion of exceptions in the .NET Framework, see Handling and Throwing Exceptions.

Portions Copyright 2005 Microsoft Corporation. All rights reserved.

Portions Copyright Addison-Wesley Corporation. All rights reserved.

For more information on design guidelines, see the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams, published by Addison-Wesley, 2005.

In This Section

Reference