Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Code Conventions

Valentin Simonov edited this page Feb 5, 2014 · 2 revisions

If you are going to contribute to the project please read this document and follow guidelines.
Let's keep the code clean and consistent.

Naming styles

Mostly following MSDN C# guidelines.

  • Types and namespaces: UpperCamelCase,
  • Interfaces: IUpperCamelCase,
  • Public methods, properties, fields, events: UpperCamelCase,
  • Private/protected methods, properties, fields: lowerCamelCase (no damn prefixes),
  • Static readonly/const fields: ALL_UPPER.

Formatting

  • 4 spaces instead of tabs,
  • Curly braces mostly must be on the next line,
  • No space between method names and braces in method calls.

Class layout

Class layout should follow the following structure for consistency:

#region Constants
public const float BLA = 42f;
#endregion

#region Events
public event EventHandler MyEvent;
#endregion

#region Public properties/fields
public bool Toggle;
public string Name { get { return name; } }
#endregion

#region Private/protected variables,
private string name = "undefined";
#endregion

#region Public methods
public void DoSomething() {}
#endregion

#region Unity methods (Awake, Update, etc.)
private void Awake() {}
#endregion

#region Internal methods
internal void DoSomethingInternal() {}
#endregion

#region Protected functions
protected void doSomethingProtected() {}
#endregion

#region Private functions
private void doSomethingPrivate() {}
#endregion

#region Event handlers.
private void eventHandler(object this, EventArgs e) {}
#endregion

Clone this wiki locally

Morty Proxy This is a proxified and sanitized view of the page, visit original site.