7. Coding Standards - Adam101112595/BattleShip GitHub Wiki
Coding Standards for C#
DO - PascalCasing
Use for class names and methods
//Example:
public class ClassName
{
public void MethodName
{
//Code Here
}
}
DO - camelCasing
Use for method arguments and local variables
//Example:
int itemVar;
DO NOT - Screaming Caps
for constants/read only variables
//Example:
const string STRINGNAME = "name";
DO NOT - Underscores
for identifiers, private static variables are the only exception
//Bad Example:
public string name_here
//Exception Example:
private string _nameHere;
DO - Predefined Type Names
- use bool instead of Boolean
- use int instead of Int32, ect
DO - Use nouns for naming classes
eg. Employee, Location, DocCollection...
This makes them easier to remember
DO - Vertical Curly Brackets
//Example:
class Program
{
static void Main()
{
//Code Here
}
}
Reference: http://www.dofactory.com/reference/csharp-coding-standards