I am trying to clean up warnings R# 6.1 is generating for my classes and one of the issues ReSharper is reporting is that I have incorrect capitalization on a variable. For instance I have var RECDLeft = new RECD(); and it recommends that I change it to var recdLeft = new RECD() despite it being an acronymn defined in the list. I have manually added the RECD acronym to the list of acronyms because it wasn’t asking me to add it in the quick fix menu. I have noticed that if I call the variable `var aRECDLeft’ it recognizes the acronym properly. Is there a reason acronyms are not recognized at the beginning of a variable name? And is there a way to make R# recognize this usage besides moving the acronym to the second word?
Thanks,
Mark Smith
In answer to your first question, I guess R# is trying to conform to Microsoft’s C# conventions for acronyms:
Capitalization Rules for Acronyms
Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.
A property named
DBRateis an example of a short acronym (DB) used as the first word of a Pascal-cased identifier. A parameter namedioChannelis an example of a short acronym (IO) used as the first word of a camel-cased identifier.Do capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier.
A class named
XmlWriteris an example of a long acronym used as the first word of a Pascal-cased identifier. A parameter namedhtmlReaderis an example of a long acronym used as the first word of a camel-cased identifier.Do not capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.
A parameter named
xmlStreamis an example of a long acronym (xml) used as the first word of a camel-cased identifier. A parameter nameddbServerNameis an example of a short acronym (db) used as the first word of a camel-cased identifier.