A combination of,
The main differences compared to RehanSaeed/EditorConfig is in the following,
Adapted from dotnet/runtime
- We use
_camelCasefor internal and private fields and usereadonlywhere possible. Prefix internal and private instance fields with_, static fields withs_and thread static fields witht_. When used on static fields,readonlyshould come afterstatic(e.g.static readonlynotreadonly static). Public fields should be used sparingly and should use PascalCasing with no prefix when used. - We avoid
this.unless absolutely necessary. - Namespace imports should be specified at the top of the file, outside of
namespacedeclarations, and should be sorted alphabetically, with the exception ofSystem.*namespaces, which are to be placed on top of all others. - Prefers the use of conditional expression for assignment and return.
- We only use
varwhen the type is explicitly named on the right-hand side, typically due to eithernewor an explicit cast, e.g.var stream = new FileStream(...)notvar stream = OpenStandardInput().- Similarly, target-typed
new()can only be used when the type is explicitly named on the left-hand side, in a variable definition statement or a field definition statement. e.g.FileStream stream = new(...);, but notstream = new(...);(where the type was specified on a previous line).
- Similarly, target-typed
csharp_indent_labelsset toone_less_than_current: See optionscsharp_indent_case_contents_when_blockset totrue: See optionscsharp_space_around_declaration_statementsset todo_not_ignore(❔as per this, the options areignore,falsebut most dotnet repos set todo_not_ignore).- We use PascalCasing to name all our constant local variables and fields.