Skip to content

Coding guidelines

Bob edited this page Jun 25, 2020 · 2 revisions

These are a coding guidelines for the project, when in doubt, consult the Microsoft naming guidelines for anything not included in this list:

Do note these are all guidelines, and not strictly rules. These guidelines do not cover every single case, and in some cases deviation from the guidelines is acceptable.

Casing:

  • Use PascalCasing for classes, structs, methods, properties, events and enums
  • Use camelCasing for fields, parameters and local variables

Naming:

  • Use full worlds instead of abbreviations
  • Use method names that describe what the method does
  • Do not use Hungarian notation
  • Do not use underscores in variable names
  • Minimize amount of comments, often comments can be replaced by proper method / variable names

CLR type names vs aliases

  • When referencing a type in a method name, use the CLR type name over aliases
  • When using a CLR type as a variable type use the alias instead of the CLR type

Namespaces:

  • Use namespaces that correspond to directories
  • Use PascalCase for namespaces

Class structures:

Classes should be written in the following order:

  • public propreties
  • private properties
  • private fields
  • constructor
  • public methods
  • delegates & events
Clone this wiki locally