Skip to main content

C# Casing methods 101 - Mastering the different casing conventions

Mastering the different casing conventions and when to use them can make your code more readable and easier to understand for yourself and others. In this post, you will learn how and when to use the different casing methods.

Christian Schou

As a programming language, C# provides developers with a number of different methods for formatting identifiers such as variables, methods, and classes. One of the most important formatting considerations in C# is casing, which refers to the use of different combinations of uppercase and lowercase letters to represent different types of identifiers.


Using consistent casing conventions not only makes your code easier to read and understand but also helps to maintain it over time. In this blog post, I'll take you through the most common casing methods used in C#, including Pascal case, Kebab case, Camel case, and Snake case. Additionally, I'll introduce some lesser-known casing conventions like Train case, Title case, and Constant case.

By the end of this post, you'll be able to choose the appropriate casing method for your specific programming scenario and understand how to apply it consistently throughout your code. So let's dive in and explore the world of C# casing! 🙌

Pascal Case

Pascal case, also known as upper camel case, is a popular casing convention in C# and many other programming languages. It involves capitalizing the first letter of each word, with no spaces or other delimiters between them. For example, the identifier FirstName is written in Pascal case.

Pascal case is commonly used for class names and other types of identifiers that represent objects or concepts. It's also used for method names and property names, but only when they represent a specific action or behavior.

Here are a few examples of identifiers written in Pascal case.

public class CustomerOrder
    public int OrderId { get; set; }
    public string CustomerName { get; set; }
    public DateTime OrderDate { get; set; }
    public void AddOrderItem(OrderItem item)
        // code to add order item to order

public enum Color

In the code example above, the class name CustomerOrder and the enum name Color are both written in Pascal case. Additionally, the property names OrderId, CustomerName, and OrderDate follow Pascal case conventions.

By using Pascal case for these types of identifiers, we can easily distinguish them from variables and other types of identifiers, which are typically written in camel case or snake case. Additionally, using Pascal case for class names and enum names makes it clear that they represent object-oriented concepts, rather than variables or data structures.

When to use Pascal case

That's an overview of Pascal case in C#. In the next section, we'll explore Kebab case, another popular casing convention.

Kebab Case

Kebab case, also known as dash case or spinal case, is a casing convention where words are separated by hyphens (-). For example, the identifier first-name is written in kebab case.

Kebab case is not commonly used in C# code, but it can be useful for naming files and directories in some operating systems. It's also commonly used in web development for HTML and CSS class names, as well as for routing URLs in web applications.

Here's an example of a C# method written in kebab case.