成员设计准则Member Design Guidelines

方法、属性、事件、构造函数和字段统称为成员。Methods, properties, events, constructors, and fields are collectively referred to as members. 框架功能最终以成员的方式向框架用户公开。Members are ultimately the means by which framework functionality is exposed to the end users of a framework.

成员可以是虚拟的或非虚拟的,具体的或抽象的,静态的或实例的,并且可以具有多个不同的可访问范围。Members can be virtual or nonvirtual, concrete or abstract, static or instance, and can have several different scopes of accessibility. 这些多样性提供了令人难以置信的表现力,但同时也需要框架设计者小心处理。All this variety provides incredible expressiveness but at the same time requires care on the part of the framework designer.

本章提供了在设计任何类型的成员时应遵循的基本准则。This chapter offers basic guidelines that should be followed when designing members of any type.

本节内容In This Section

成员重载Member Overloading
属性设计Property Design
构造函数设计Constructor Design
事件设计Event Design
字段设计Field Design
扩展方法Extension Methods
运算符重载Operator Overloads
参数设计Parameter Design
部分©2005,2009 Microsoft Corporation。保留所有权利。Portions © 2005, 2009 Microsoft Corporation. All rights reserved.

*在 Pearson Education, Inc. 授权下,由 Addison-Wesley Professional 作为 Microsoft Windows 开发系列的一部分再版自 Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 2nd Edition(Framework 设计准则:可重用 .NET 库的约定、惯例和模式第 2 版),由 Krzysztof Cwalina 和 Brad Abrams 发布于 2008 年 10 月 22 日。Reprinted by permission of Pearson Education, Inc. from Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 2nd Edition by Krzysztof Cwalina and Brad Abrams, published Oct 22, 2008 by Addison-Wesley Professional as part of the Microsoft Windows Development Series.

另请参阅See also