Design Guidelines for Class Library Developers
The .NET Framework's managed environment allows developers to improve their programming model to support a wide range of functionality. The goal of the .NET Framework design guidelines is to encourage consistency and predictability in public APIs while enabling Web and cross-language integration. It is strongly recommended that you follow these design guidelines when developing classes and components that extend the .NET Framework. Inconsistent design adversely affects developer productivity. Development tools and add-ins can turn some of these guidelines into de facto prescriptive rules, and reduce the value of nonconforming components. Nonconforming components will function, but not to their full potential.
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 provide a solid justification for your decision. The section provides naming and usage guidelines for types in the .NET Framework as well as guidelines for implementing common design patterns.
In This Section
- Relationship to the Common Type System and the Common Language Specification
Describes the role of the common type system and the Common Language Specification in class library development. - Naming Guidelines
Describes the guidelines for naming types in class libraries. - Class Member Usage Guidelines
Describes the guidelines for using properties, events, methods, constructors, fields, and parameters in class libraries. - Type Usage Guidelines
Describes the guidelines for using classes, value types, delegates, attributes, and nested types in class libraries. - Guidelines for Exposing Functionality to COM
Describes the guidelines for exposing class library types to COM. - Error Raising and Handling Guidelines
Describes the guidelines for raising and handling errors in class libraries. - Array Usage Guidelines
Describes the guidelines for using arrays in class libraries and how to decide whether to use an array vs. a collection. - Operator Overloading Usage Guidelines
Describes the guidelines for implementing operator overloading in base class libraries. - Guidelines for Implementing Equals and the Equality Operator (==)
Describes the guidelines for implementing the Equals method and the equality operator (==) in class libraries. - Guidelines for Casting Types
Describes the guidelines for casting types in class libraries. - Common Design Patterns
Describes how to implement design patterns for Finalize and Dispose methods, the Equals method, callback functions, and time-outs. - Security in Class Libraries
Describes the precautions to take when writing highly trusted class library code, and how to help protect resources with permissions. - Threading Design Guidelines
Describes the guidelines for implementing threading in class libraries. - Guidelines for Asynchronous Programming
Describes the guidelines for implementing asynchronous programming in class libraries and provides an asynchronous design pattern.
Related Sections
- Class Library
Documents each of the public classes that constitute the .NET Framework.