| TypeName | ShortAcronymsShouldBeUppercase |
| CheckId | CA1706 |
| Category | Microsoft.Naming |
| Breaking Change | Breaking |
The name of an identifier contains a two-letter acronym and the second letter is lowercase.
This rule splits the name into words based on the casing and checks any two-letter words against a list of common two-letter words, such as "In" or "My". If a match is not found, the word is assumed to be an acronym. For parameters, the first word is ignored due to the camel casing convention used for parameter names.
By convention, two-letter acronyms use all uppercase letters, and acronyms of three or more characters use Pascal casing. The following examples conform to this naming convention: 'DB', 'CR', 'Cpa', and 'Ecma'. The following examples violate the convention: 'Io', 'XML', and 'DoD', and for non-parameter names, 'xp' and 'cpl'.
'ID' is special-cased to cause a violation of this rule. 'Id' is not an acronym but is an abbreviation for 'identification'.
Naming conventions provide a common look for libraries that target the common language runtime. This reduces the learning curve required for new software libraries, and increases customer confidence that the library was developed by someone with expertise in developing managed code.
To fix a violation of this rule, change the second letter of the acronym to uppercase.
It is safe to exclude a warning from this rule if the two letters are not an acronym but instead form a word or proper name.
Identifiers should be cased correctly
Edit: I think to all intents and purposes, they're the same; whether they are considered abbreviations, acronyms or initialisms is irrelevant (http://en.wikipedia.org/wiki/Acronym_and_initialism). This topic is in fact about casing guidelines, not about the linguistics of acronyms. So I think it's acceptable to read the following statement as such, "If a match is not found, the word is assumed to be an acronym, initialism or abbreviation". Hence why Captcha, IO and Xml all have these recommended casings according to the rules outlined in this topic.
...even by MS sources on UI design guidelines. Technical Writers constantly point this out to us devs and FxCop complains the opposite. How to you turn off this irritating exception to the rule in FxCop? (...because I cannot turn off my tech writers =) )
[edit - David M. Kean - MSFT] Thanks for your feedback. FxCop fires this rule on API declarations, and not UI terms. API declarations (for most applications) will not appear in the UI.
[edit - Andrew] ID is ID and should be ID everywhere. If I generate documentation based from the code, then the generated documentation will be in violation of the ID rule.
For more information on the guidelines this rule enforces, see the following external resources:
Capitalization Conventions, Design Guidelines for Developing Class Libraries
http://msdn2.microsoft.com/en-us/library/ms229043.aspx
Page 36, Framework Design Guidelines: Conventions, Idioms and Patterns for Reusable .NET Libraries
Krzysztof Cwalina and Brad Abrams
http://www.amazon.com/gp/product/0321246756/002-6248839-4752853?v=glance&n=283155