Reputation: 11903
Have you ever wondered why MS doesn't write abbreviations in all upper case? Like Guid, BmpBitmapEncoder, System.Net.Mime, HttpWebRequest, XmlDocument, etc., instead of GUID, BMPBitmapEncoder, System.Net.MIME, HTTPWebRequest, XMLDocument. I suspect it's for better readability, but in my opinion, it's worse, and maybe even a bit incorrect. Is there an MS document that explains why they decided to do it like this? I'm sure it's intentional, but here's a bonus question, find a name in the BCL which contains an all upper case abbreviation :)
Upvotes: 2
Views: 485
Reputation: 164301
I haven't been able to find a reference to why it is so (but I expect readability was the concern). However, it is stated in the guidelines, that abbreviations with more than 2 letters should be PascalCased.
"Do capitalize only the first character of acronyms with three or more characters, except the first word of a camel-cased identifier."
Upvotes: 0
Reputation: 283684
The rule they use is that two-character acronyms are left uppercase: IOException
While longer acronyms are treated as words and use initial cap.
From http://msdn.microsoft.com/en-us/library/ms229043.aspx:
The following guidelines specify the proper casing for short and long acronyms. The identifier casing rules take precedence over acronym casing rules.
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 namedioChannel
is 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
XmlWriter
is an example of a long acronym used as the first word of a Pascal-cased identifier. A parameter namedhtmlReader
is 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
xmlStream
is an example of a long acronym (xml) used as the first word of a camel-cased identifier. A parameter nameddbServerName
is an example of a short acronym (db) used as the first word of a camel-cased identifier.
Upvotes: 6