Capitalization Rules
- The PascalCasing convention, used for all identifiers except parameter names, capitalizes the first character of each word (including acronyms over two letters in length), as shown in the following examples:
DO use PascalCasing for
- Namespace
- Type
- Interface
- Method
- Property
- Event
- Field
- Enum value
- The camelCasing convention, used only for parameter names, capitalizes the first character of each word except the first word, as shown in the following examples. As the example also shows, two-letter acronyms that begin a camel-cased identifier are both lowercase.
propertyDescriptor ioStream htmlTag
DO use camelCasing for parameter names.
Case Sensitivity
DO NOT assume that all programming languages are case sensitive. They are not. Names cannot differ by case alone.
Word Choice
- DO choose easily readable identifier names.
For example, a property named HorizontalAlignment is more English-readable than AlignmentHorizontal. - DO NOT use underscores, hyphens, or any other nonalphanumeric characters.
- DO NOT use Hungarian notation.
- AVOID using identifiers that conflict with keywords of widely used programming languages.
Using Abbreviations and acronyms
- DO NOT use abbreviations or contractions as part of identifier names.
For example, use GetWindow rather than GetWin. - X DO NOT use any acronyms that are not widely accepted, and even if they are, only when necessary.
Avoid Language Specific Names
- DO use semantically interesting names rather than language-specific keywords for type names.
For example, GetLength is a better name than GetInt. - DO use a generic CLR type name, rather than a language-specific name, in the rare cases when an identifier has no semantic meaning beyond its type.
- DO name classes and structs with nouns or noun phrases, using PascalCasing.
- DO name interfaces with adjective phrases, or occasionally with nouns or noun phrases.
- DO NOT give class names a prefix (e.g., "C").
- CONSIDER ending the name of derived classes with the name of the base class.
- DO prefix interface names with the letter I, to indicate that the type is an interface.
- DO ensure that the names differ only by the "I" prefix on the interface name when you are defining a class–interface pair where the class is a standard implementation of the interface.