Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions _pages/2400_LayoutGuidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sidebar:
- Start the LINQ statement with all the `from` expressions and don't interweave them with restrictions.
- Add parentheses around every binary expression, but don't add parentheses around unary expressions. For example `if (!string.IsNullOrEmpty(str) && (str != "new"))`

- Add an empty line between multi-line statements, between multi-line members, after the closing curly braces, between unrelated code blocks, around the `#region` keyword, and between the `using` statements of different root namespaces.
- Add an empty line between multi-line statements, between multi-line members, after the closing curly braces, between unrelated code blocks, and between the `using` statements of different root namespaces.

### <a name="av2402"></a> Order and group namespaces according to the company (AV2402) ![](/assets/images/3.png)

Expand All @@ -79,7 +79,7 @@ Always place these directives at the top of the file, before any namespace decla
### <a name="av2406"></a> Place members in a well-defined order (AV2406) ![](/assets/images/1.png)
Maintaining a common order allows other team members to find their way in your code more easily. In general, a source file should be readable from top to bottom, as if reading a book, to prevent readers from having to browse up and down through the code file.

1. Private fields and constants (in a region)
1. Private fields and constants
2. Public constants
3. Public static read-only fields
4. Factory methods
Expand All @@ -90,12 +90,8 @@ Maintaining a common order allows other team members to find their way in your c

Declare local functions at the bottom of their containing method bodies (after all executable code).

### <a name="av2407"></a> Be reluctant with `#region` (AV2407) ![](/assets/images/1.png)
Regions can be helpful, but can also hide the main purpose of a class. Therefore, use `#region` only for:

- Private fields and constants (preferably in a `Private Definitions` region).
- Nested classes
- Interface implementations (only if the interface is not the main purpose of that class)
### <a name="av2407"></a> Do not use `#region` (AV2407) ![](/assets/images/1.png)
Regions require extra work without increasing the quality or the readability of code. Instead they make code harder to view and refactor.

### <a name="av2410"></a> Use expression-bodied members appropriately (AV2410) ![](/assets/images/1.png)
Favor expression-bodied member syntax over regular member syntax only when:
Expand Down
6 changes: 3 additions & 3 deletions _pages/Cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ NOTE: Requires Markdown Extra. See http://michelf.ca/projects/php-markdown/extra
* Don't use mutually exclusive properties (AV1110)
* A property, method or local function should do only one thing (AV1115)
* Don't expose stateful objects through static members (AV1125)
* Return an `IEnumerable<T>` or `ICollection<T>` instead of a concrete collection class (AV1130)
* Return an `IEnumerable<T>` or `ICollection<T>` instead of a concrete collection class (AV1130)
* Properties, arguments and return values representing strings, collections or tasks should never be `null` (AV1135)
* Define parameters as specific as possible (AV1137)
</td>
Expand Down Expand Up @@ -203,7 +203,7 @@ NOTE: Requires Markdown Extra. See http://michelf.ca/projects/php-markdown/extra
* Add parentheses around every binary expression, but don't add parentheses around unary expressions
<br/>

* Be reluctant with #region (AV2407)
* Do not use `#region` (AV2407)
* Use expression-bodied members appropriately (AV2410)
</td>
<td class="column">
Expand All @@ -227,7 +227,7 @@ NOTE: Requires Markdown Extra. See http://michelf.ca/projects/php-markdown/extra
3. Public static readonly fields
4. Factory methods
5. Constructors and the finalizer
6. Events
6. Events
7. Public properties
8. Other methods and private properties in calling order
</div>
Expand Down