You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: Documentation/coding-guidelines/coding-style.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,10 +9,10 @@ The general rule we follow is "use Visual Studio defaults".
9
9
10
10
1. We use [Allman style](http://en.wikipedia.org/wiki/Indent_style#Allman_style) braces, where each brace begins on a new line. A single line statement block can go without braces but the block must be properly indented on its own line and it must not be nested in other statement blocks that use braces (See issue [381](https://github.com/dotnet/corefx/issues/381) for examples).
11
11
2. We use four spaces of indentation (no tabs).
12
-
3. We use `_camelCase` for internal and private fields and use `readonly` where possible. Prefix instance fields with `_`, static fields with `s_` and thread static fields with `t_`. When used on static fields, `readonly` should come after `static` (i.e. `static readonly` not `readonly static`).
12
+
3. We use `_camelCase` for internal and private fields and use `readonly` where possible. Prefix instance fields with `_`, static fields with `s_` and thread static fields with `t_`. When used on static fields, `readonly` should come after `static` (e.g. `static readonly` not `readonly static`).
13
13
4. We avoid `this.` unless absolutely necessary.
14
-
5. We always specify the visibility, even if it's the default (i.e.
15
-
`private string _foo` not `string _foo`). Visibility should be the first modifier (i.e.
14
+
5. We always specify the visibility, even if it's the default (e.g.
15
+
`private string _foo` not `string _foo`). Visibility should be the first modifier (e.g.
16
16
`public abstract` not `abstract public`).
17
17
6. Namespace imports should be specified at the top of the file, *outside* of
18
18
`namespace` declarations and should be sorted alphabetically.
@@ -23,8 +23,8 @@ The general rule we follow is "use Visual Studio defaults".
23
23
Consider enabling "View White Space (Ctrl+E, S)" if using Visual Studio, to aid detection.
24
24
9. If a file happens to differ in style from these guidelines (e.g. private members are named `m_member`
25
25
rather than `_member`), the existing style in that file takes precedence.
26
-
10. We only use `var` when it's obvious what the variable type is (i.e. `var stream = new FileStream(...)` not `var stream = OpenStandardInput()`).
27
-
11. We use language keywords instead of BCL types (i.e.`int, string, float` instead of `Int32, String, Single`, etc) for both type references as well as method calls (i.e. `int.Parse` instead of `Int32.Parse`). See issue [391](https://github.com/dotnet/corefx/issues/391) for examples.
26
+
10. We only use `var` when it's obvious what the variable type is (e.g. `var stream = new FileStream(...)` not `var stream = OpenStandardInput()`).
27
+
11. We use language keywords instead of BCL types (e.g.`int, string, float` instead of `Int32, String, Single`, etc) for both type references as well as method calls (e.g. `int.Parse` instead of `Int32.Parse`). See issue [391](https://github.com/dotnet/corefx/issues/391) for examples.
28
28
12. We use PascalCasing to name all our constant local variables and fields. The only exception is for interop code where the constant value should exactly match the name and value of the code you are calling via interop.
29
29
13. We use ```nameof(...)``` instead of ```"..."``` whenever possible and relevant.
30
30
14. Fields should be specified at the top within type declarations.
0 commit comments