I have a property “EntityID” in a class. Resharper (5.1) says
Name ‘EntityID’ does not match rule
‘Methods, properties and events’.
Suggested name is ‘EntityId’.
But IMHO according to the naming conventions in the Design Guidelines for Class Library Developers. ‘EntityID’ should be perfectly fine:
- Do not use acronyms that are not generally accepted in the computing
field.- Where appropriate, use well-known acronyms to replace lengthy phrase
names. For example, use UI for User
Interface and OLAP for On-line
Analytical Processing.- When using acronyms, use Pascal case or camel case for acronyms more than
two characters long. For example, use
HtmlButton or htmlButton. However, you
should capitalize acronyms that
consist of only two characters, such
as System.IO instead of System.Io.- Do not use abbreviations in identifiers or parameter names. If you
must use abbreviations, use camel case
for abbreviations that consist of more
than two characters, even if this
contradicts the standard abbreviation
of the word
*Update: * The latest version of the guidelines also say:
Do capitalize both characters of two-character acronyms, except the
first word of a camel-cased identifier.
A property named DBRate is an example of a short acronym (DB) used
as the first word of a Pascal-cased
identifier. A parameter named
ioChannel is an example of a short
acronym (IO) used as the first word of
a camel-cased identifier.
Am I understanding the guidelines correctly? If so, how can I make ReSharper accept “EntityID” (well known two letter acronym) but reject “HTMLReader” (it should be HtmlReader).
Do you want to stick to the recommendations of the Framework Design Guidelines, or do you want to use uppercase
IDregardless?The latest version of the guidelines has this to say:
So it seems that ReSharper is correct in the case of
Id.Out of interest, ReSharper also recommends that two character acronyms follow the same casing rules. This is at odds with the guidelines: “Do capitalize both characters of two-character acronyms, except the first word of a camel-cased identifier.”