C# Variable Naming Capitalization Styles Refresher from MSDN
Edit
LOGO, VB, Pascal, Java, Perl, ActionScript, PHP, JavaScript, CSS, C# --- There are too many language I have been programming with and each have their suggested naming convention. Every now and then I need to go back and look at how to properly name my variables and classes so as to conform to the standard of the language. And today, it's time to refresh on C# variable naming convention style!
The following table summarizes the capitalization rules and provides examples for the different types of identifiers.
The following table summarizes the capitalization rules and provides examples for the different types of identifiers.
Identifier | Case | Example |
---|---|---|
Class | Pascal | AppDomain |
Enum type | Pascal | ErrorLevel |
Enum values | Pascal | FatalError |
Event | Pascal | ValueChange |
Exception class | Pascal | WebExceptionNote Always ends with the suffix Exception. |
Read-only Static field | Pascal | RedValue |
Interface | Pascal | IDisposable
Note Always begins with the prefix
|
Method | Pascal | ToString |
Namespace | Pascal | System.Drawing |
Parameter | Camel | typeName |
Property | Pascal | BackColor |
Protected instance field | Camel | redValueNote Rarely used. A property is preferable to using a protected instance field. |
Public instance field | Pascal | RedValueNote Rarely used. A property is preferable to using a public instance field. |
C# Variable Naming Capitalization Styles Refresher from MSDN
Reviewed by DF
on
8:10:00 PM
Rating: