C#: Pascal and camel case format

This entry is part 15 of 71 in the series C#

In C#, there are 2 general ways to declare an identifier such as variable name or class name.

The first is the Pascal format where the we capitalize the first letter of each word in an identifier name.  These are commonly used in Class names, namespace names and function names.

Example: Hello, DisplayName, PrintOutput

Another common format is the camel case where the first letter is in lowercase.  These are commonly used for varriable names.

Example: quotient, firstName, book, camelCase

We should use more meaningful names for classes and variables.  Note that variables in C# are case sensitive.

Use Meaningful Identifiers
using System;

namespace Hello
    class Friend
        public void displayName()
            string name;

            Console.WriteLine("Hello, what is your name?");
            name = Console.ReadLine();
            Console.WriteLine("Your name is " + name);

        static void Main()
            Friend friend = new Friend();



Series Navigation<< C#: Accessing methods using dot
C#: Passing an argument or a variable into a method >>

Leave a comment

Leave a Reply