Compound words should be cased correctly
This warning is supported in the stand-alone version of FxCop only. It is not supported in Code Analysis, which is integrated into Visual Studio.
TypeName |
CompoundWordsShouldBeCasedCorrectly |
CheckId |
CA1702 |
Category |
Microsoft.Naming |
Breaking Change |
Breaking |
Cause
The name of an identifier contains multiple words and at least one of the words appears to be a compound word that is not cased correctly.
Rule Description
The name of the identifier is split into words based on the casing. Each contiguous two word combination is checked by the Microsoft spelling checker library. If recognized, the identifier produces a violation of the rule. Examples of compound words that cause a violation are "CheckSum" and "MultiPart", which should be cased as "Checksum" and "Multipart", respectively. Because of previous common usage, several exceptions are built into the rule, and some single words are flagged, such as "Toolbar" and "Filename", that should be cased as two distinct words. In this case, "ToolBar" and "FileName" should be cased as two distinct words.
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.
How to Fix Violations
Change the name so that it is cased correctly.
When to Exclude Warnings
It is safe to exclude a warning from this rule if both parts of the compound word are recognized by the spelling dictionary and the intent is to use two words.
Related Rules
Resource string compound words should be cased correctly
Identifiers should be cased correctly
Identifiers should differ by more than case
Long acronyms should be pascal-cased
Short acronyms should be uppercase