| Start | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Capitalization conventions The following terms describe different ways to case identifiers. Pascal CasingThe first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example: Camel CasingThe first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized. For example: UppercaseAll letters in the identifier are capitalized. For example: RulesWhen an identifier consists of multiple words, do not use separators, such as underscores ("_") or hyphens ("-"), between words. Instead, use casing to indicate the beginning of each word. The following table summarizes the capitalization rules for identifiers and provides examples for the different types of identifiers:
More information can be found on MSDN (opens new window). |
|||||||||||||||||||||||||||||||||||||||
Enums Use a singular name for most EnumsUse a plural name for Enum types that are bit fieldsNote: Always add the Do not add 'enum' as a suffixDo not use the enum name in each entry |
|||||||||||||||||||||||||||||||||||||||
| Interfaces Interfaces should be named with nouns or noun phrases, or adjectives that describe behaviour. For example Interface names should be prefixed with the letter Below are correctly named interfaces: |
|||||||||||||||||||||||||||||||||||||||
Exceptions Add 'exception' as a suffixCustom exception names should be suffixed with "-Exception". Below are correctly named exceptions: |
|||||||||||||||||||||||||||||||||||||||
| Private fields There are two common conventions for private fields: Camel caseCamel case with underscore |
|||||||||||||||||||||||||||||||||||||||
| Namespaces The general format for namespaces is: Examples include: Prefixing namespace names with a company name prevents namespaces from different companies from having the same name. RemarksChoose easily readable identifier namesFor example, a property named HorizontalAlignment is more readable in English than AlignmentHorizontal. Favor readability over brevityThe property name Avoid using underscores, hyphens, or any other non-alphanumeric characters. Do not use Hungarian notationHungarian notation is the practice of including a prefix in identifiers to encode some metadata about the parameter, such as the data type of the identifier, e.g. Also, avoid using identifiers that conflict with keywords already used within C#. Abbreviations and acronymsIn general, you should not use abbreviations or acronyms; these make your names less readable. Similarly, it is difficult to know when it is safe to assume that an acronym is widely recognized. |
Read Article
https://develop.horje.com/learn/1434/reference