11. Class & Method Names
Use Pascal casing for class names and method names like in following code example
1 2 3 4 5 6 7 |
public class HelloWorld { void SayHello( string name ) { ... } } |
12. Variable Name
For variables use camel notation, avoid Hungarian notation like in the visual studio 2000.
In camel notaion a variable is declare with first lower case letter and afterwards, every first character of a word is uppercase. For example “totalCount” is in camel notation form.
Do not use abbreviations. Use name, address, salary etc. instead of nam, addr, sal
Do not use single character variable names like i, n, x, etc. Use names like index and temp.
13. File Name
File names should match the class name. Though C# does not force for this rule as in java.
14. Methods
The method’s name should tell what it does.
A method should do only “one job.” Do not combine more than one job in a single method, even if those jobs are very small.
15. Variables
Use language specific data types and not the alias defined in system name space like int,long and not System.Int32 or System.Int64
Use Meaningful, descriptive words to name variables. Do not use abbreviations.
Good:
1 2 |
string address int salary |
Not Good:
1 2 |
String nam String addr |