.NET concise coding specification

zhaozj2021-02-16  92

.NET concise coding specification --Extracted from ".NET Framework General Reference Design Guidelines for Class Library Developers" version: v1.0 1 namespace Name Specification Use the company name. Product name is formatted. The dependence of NameSpace should be reflected in naming, such as the class in System.Web.ui.Design, since System.Web.ui. Use the Pascal Case. When the naming style of the trademark (product name) is not compliant, the trademark (product name) is subject to the trademark (product name). Use multiplexes in the case of proper institution, such as System.Collections. Exception is the case of abbreviations and trademarks. Namespace's name is not necessarily corresponding to Assembly. 2 Class naming specification Names or noun word phrase. Use Pascal Case. Conservative use abbreviation. Do not use the TYPE prefix, such as C to identify the class. For example, use FileStream instead of CFileStream. Do not use underscore. Occasionally, when you need to start with i in the Class name, such as IdentityStore, Just Use IT. When appropriate, use words composite to identify from a base class. For example, XXXException. 3 Interface naming specification Names or noun word word group named Interface. Use Pascal Case. Conservative use abbreviation. In the interface name, add letter i to indicate Type is Interface. At a Class is aimed at an Interface, when you use a similar name, you will name them, just in front of the name of the interface. Do not use underscores. 4 Attribute Named Specifications Always add an Attribute suffix to the Attribute class. 5 Enumeration Type Naming Specifications Use PASCAL CASE for ENUM Types and values. Do not add an Enum suffix back after the Enum type name. For most Enum types, use singular names, only in this Enum type is BIT Fields. Always add Flagsattribute to the Bit Field Enum type. 6 Static Field naming specification uses nouns, noun words or noun abbreviations to name Static Fields. Use Pascal Case. Don't use the Hungarian nomenclature in the Static Field name. In any possible case, it is recommended that you use static Properties instead of public static fields. 7 Parameter Name Specification Use Camel Case for the Parameter name. Use the descriptive name. The parameter name should be in most cases its name plus the type sufficient to describe its meaning. The name of the meaning of the description parameter is not described in the name of the parameter type. Development tools should provide meaningful information about parameter types. Thus, the name of the parameter can be used to better description. Conservative use of type-based parameter names, only use under appropriate situations. Do not use the reserved parameters. Don't use Hungarian nomenclature. 8 Method naming specification is named using verbs or verb phrases. Use Pascal Case. 9 Property naming specification Names or noun word phrase. Use Pascal Case. Don't use Hungarian nomenclature. Consider using the same name as the Property Type name as the Property Name.

转载请注明原文地址:https://www.9cbs.com/read-11996.html

New Post(0)