命名准则Naming Guidelines

在框架开发中采用一致的命名约定集可能是框架可用性的主要贡献。Following a consistent set of naming conventions in the development of a framework can be a major contribution to the framework’s usability. 它允许很多开发人员对广泛分隔的项目使用框架。It allows the framework to be used by many developers on widely separated projects. 除了表单的一致性以外,框架元素的名称也必须易于理解,并且必须传达每个元素的功能。Beyond consistency of form, names of framework elements must be easily understood and must convey the function of each element.

本章的目的是提供一组一致的命名约定,以使开发人员能够立即了解名称。The goal of this chapter is to provide a consistent set of naming conventions that results in names that make immediate sense to developers.

尽管采用这些命名约定作为一般代码开发准则会使代码的命名更加一致,但你只需将它们应用到公开 (公共或受保护类型和成员的 Api,并) 显式实现的接口。Although adopting these naming conventions as general code development guidelines would result in more consistent naming throughout your code, you are required only to apply them to APIs that are publicly exposed (public or protected types and members, and explicitly implemented interfaces).

本节内容In This Section

大小写约定Capitalization Conventions
通用命名约定General Naming Conventions
程序集和 Dll 的名称Names of Assemblies and DLLs
命名空间的名称Names of Namespaces
类、结构和接口的名称Names of Classes, Structs, and Interfaces
类型成员的名称Names of Type Members
命名参数Naming Parameters
命名资源Naming Resources
部分©2005,2009 Microsoft Corporation。保留所有权利。Portions © 2005, 2009 Microsoft Corporation. All rights reserved.

经许可重印皮尔逊教育,Inc. 的作者 :从框架设计指导原则:用于可重复使用的 .Net 库的约定、惯例和模式; 第2版 By Krzysztof Cwalina,Brad Abrams,通过 Addison-Wesley Professional 作为 Microsoft Windows 开发系列的一部分2008发布。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