Skip to content

Contributing Code Style

Starciad edited this page Jan 14, 2025 · 1 revision

We follow the Microsoft C# coding conventions, with some exceptions.

Main Preferences

  1. Prefix S in file names and IS for interfaces;
  2. Use this to reference fields and properties;
  3. Avoid asynchronous code in inappropriate contexts.

Other Preferences

  1. Do not use var;
  2. Mark immutable fields as readonly;
  3. Use internal and public sparingly;
  4. Utilize object initializers whenever possible.
  5. All created constants must be strictly only in the constants directory present in some file.

Inline out Declarations

Prefer inline form for out declarations: SomeOutMethod(42, out PType value);.

Member Ordering

Always order members and properties:

  1. Properties
  2. Variable Fields
  3. Events and Delegates
  4. Constructors
  5. Methods