Sdílet prostřednictvím


Design Guidelines for Developing Class Libraries

The design guidelines for developing class libraries are for library development that extends and interacts with the .NET Framework. The goal of the .NET Framework design guidelines is to help library designers ensure that their users reap the benefits of API consistency and ease of use by providing a unified programming model that is independent of the programming language used for development. It is strongly recommended that you follow these design guidelines when developing classes and components that extend the .NET Framework. Inconsistent library design adversely affects developer productivity and discourages adoption.

These guidelines are intended to help class library designers understand the trade-offs between different solutions. There might be situations where good library design requires that you violate these design guidelines. Such cases should be rare, and it is important that you have a clear and compelling reason for your decision.

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

  • Guidelines for Names
    Describes guidelines for naming types and members in class libraries.

  • Type Design Guidelines
    Describes guidelines for using static and abstract classes, interfaces, enumerations, and structures.

  • Member Design Guidelines
    Describes guidelines for designing and using properties, methods, constructors, fields, events, and operators. This section also describes best practices for designing parameters.

  • Designing for Extensibility
    Describes guidelines for designing libraries that can be extended.

  • Design Guidelines for Exceptions
    Describes design guidelines for designing, throwing, and catching exceptions.

  • Usage Guidelines
    Describes guidelines for using arrays and attributes, and guidelines for implementing equality operators.

See Also

Reference

Asynchronous Programming Design Patterns