How to use Pascal Casing and Camel Casing for Short Acronyms in C#?

The Light picture The Light · Sep 11, 2012 · Viewed 15.1k times · Source

A short acronym is like ID or DB which has only 2 characters.

How to name these when pascal casing (for Property or Class names) and for Camel Casing (input prameters, arguments)?

I know each Company has their own standard but I'm looking for a more generally acceptable standard.

e.g. when pascal casing:

ProductID or ProductId?
IDOfProduct or IdOfProduct?
DBRate or DbRate?
RateOfDB or RateOfDb?

and when camel casing:

productID or productId?
idOfProduct?
dbRate?
rateOfDb or rateOfDB?

Answer

mcabral picture mcabral · Sep 11, 2012

According to MSDN (or Msdn :)

  • Do capitalize both characters of two-character acronyms, except 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.

  • Do not capitalize any of the characters of any acronyms, whatever their length, at the beginning of a camel-cased identifier.

More info here