问题
Because of these two KB articles, I am confused:
- CA1704: Identifiers should be spelled correctly
- CA1709: Identifiers should be cased correctly
I have a property named ICD9
. My code analysis says that I have to change it to Icd
That sounds reasonable to me. I go and change it to Icd9
(I am not sure why it's suggesting Icd
not Icd9
) and I get a different warning
The KB says if my acronym is three-letter long I should use Pascal casing. Isn't Icd9
Pascal cased? I feel that 9
has causing the issue.
回答1:
The first warning is because ICD
is not the dictionary as an acronym, so it tells you not to use all caps.
The second warning is because ICD
is not in the dictionary at all, so it thinks it is a misspelled word.
Either add ICD
to the custom dictionary (as a normal word to get rid of the second warning or as a acronym and you can switch back to ICD9
and get rid of the first warning), or try to avoid short acronym names and use a longer more descriptive name for the property that uses words that are in the dictionary.
来源:https://stackoverflow.com/questions/31360535/code-analysis-lost-between-ca1709-and-ca1704