C# Language Naming Conventions Capitalization conventions

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

The following terms describe different ways to case identifiers.

Pascal Casing

The first letter in the identifier and the first letter of each subsequent concatenated word are capitalized. You can use Pascal case for identifiers of three or more characters. For example: BackColor

Camel Casing

The first letter of an identifier is lowercase and the first letter of each subsequent concatenated word is capitalized. For example: backColor

Uppercase

All letters in the identifier are capitalized. For example: IO


Rules

When an identifier consists of multiple words, do not use separators, such as underscores ("_") or hyphens ("-"), between words. Instead, use casing to indicate the beginning of each word.

The following table summarizes the capitalization rules for identifiers and provides examples for the different types of identifiers:

IdentifierCaseExample
Local variableCamelcarName
ClassPascalAppDomain
Enumeration typePascalErrorLevel
Enumeration valuesPascalFatalError
EventPascalValueChanged
Exception classPascalWebException
Read-only static fieldPascalRedValue
InterfacePascalIDisposable
MethodPascalToString
NamespacePascalSystem.Drawing
ParameterCameltypeName
PropertyPascalBackColor

More information can be found on MSDN.



Got any C# Language Question?