C Sharp


Because objects are supposed to be living, breathing entities that have abilities, name classes by using nouns that describe the class's problem domain. In cases where the class is more generic (that is, less specific to the problem domain) than that-for example, a type that represents an SQL string-use Pascal casing.


Use Pascal casing on all methods. Methods are meant to act-they carry out work. Therefore, let the names of your methods depict what they do. Examples of this are PrintInvoice and OpenDatabase.

In the case of methods that will be used in Boolean expressions, prefix the method with a verb that indicates what the method will do. For example, if you have a method that will return a Boolean value based on whether a workstation is locked, name the method something like IsWorkStationLocked. That way, if the method is used in an if statement, its meaning will be much clearer, as shown here: -

if (IsWorkStationLocked) ...

Method Arguments

Use Pascal casing on all arguments. Give meaningful names to arguments so that when IntelliSense is used, the user can see immediately what each argument is used for.


Use Pascal casing on all interfaces. It's common to prefix interface names with a capital "I"-for example, IComparable. (This is the only Hungarian notation"like convention that I know of in C#.) -

Many developers use the same rules when naming interfaces as they do when naming classes. However, there's a fundamental philosophical difference between the two. Classes represent an encapsulation of data and the functions that work on that data. Interfaces, on the other hand, represent behavior. By implementing an interface, you're saying that a class can exhibit that behavior. Therefore, a common technique is naming interfaces with adjectives. For example, an interface that declares methods for serializing data might be called ISerializable to easily denote the capability being taken on by the implementing class.

by BrainBellupdated