Home  /  Questions  /  Question

70   96.1
Jul 31, 2010

camelCase - PascalCase vs. CamelCase - pascalCase

The article on c# coding standards in the reference section of dofactory  states:

do use CamelCasing for class names and method names.
do use pascalCasing for method arguments and local variables.
I believe it should read:

do use PascalCasing for class names and method names.
do use camelCasing for method arguments and local variables.

Kind regards,

Ya you are absolutely right, when i first read your 2nd and 3rd line i was confused and in my mind same thing arose that you have written in 5th and 6th line. --- Shyam Kumar  Aug 01, 2010
Dirk, you are rite. --- Mihir Vinchhi  Aug 01, 2010
You are right but still for private methods we should go for camalCasing only the public methods can have PascalCasing. Sathik --- Sakubar Sathik Khan  Aug 25, 2010

830   99.9
Aug 02, 2010
Good catch guys!  This was a test of course and you all passed :-)
Anyhow, the page has been corrected.

Aug 25, 2010
You are right, but for 

1) private methods we should go for camelCasing, and
2) only public methods can have PascalCasing

 1 comment
I can't say that I agree with you. My recommendation is that both public/private methods are written in PascalCasing. For me that feels more natural and this is also recommended by MSFT (http://msdn.microsoft.com/en-us/library/x2dbyw72(v=VS.71).aspx). Of course, as always with naming guidelines there is seldom a right or wrong path but the most important is to choose a specific one and stick with it. --- Robert Blixt  Aug 25, 2010

830   99.9
Aug 25, 2010

With all due respect, this is not a convention in C#.  All methods in C# are PascalCased.

0   0
Jan 09, 2018
We have been knowing all the things about the choices game cheats and we are ready to get the diamonds here for the game.

555   99.9
Aug 02, 2010
Funny... I am just now reviewing code of some colleagues who regularily seem to start member variables with upper case characters, what they shouldn't. ;-) I wanted to let them know about Camel- and Pascal-Casing and researched their respective origins on Wikipedia just about 5 Minutes before I stumbled accross your question. What a coincidance. ;-)

This is, what Wikipedia says:

(camel case or camel-case)—originally known as medial capitals[1]—is the practice of writing compound words or phrases in which the elements are joined without spaces, with each element's initial letter capitalized within the compound, and the first letter is either upper or lower case—as in "LaBelle", BackColor, "McDonald's", or "iPod". The name comes from the uppercase "bumps" in the middle of the compound word, suggestive of the humps of a camel. The practice is known by many other names. In computer programming if the first letter is capitalized, it is called Pascal case; if not, then camel case.

While the article basically says that it doesn't matter whether you start with an upper case character or not as long as you capitilize each element's initial letter, it clearly states that in programming languages you need to start lower case. Otherwise it's called pascal case. ;-)