File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,21 @@ return condition
65
65
```
66
66
* ternary operator*
67
67
68
- ## Expression-bodied members
68
+ ## Switch Expression
69
+
70
+ Prefer switch expressions over switch statements.
71
+
72
+ ``` csharp
73
+ return animalKind switch
74
+ {
75
+ AnimalKind .Dog => " dog" ,
76
+ AnimalKind .Cat => " cat" ,
77
+ _ => throw new InvalidOperationException ($" Unsupported animal kind {animalKind }" ),
78
+ };
79
+ ```
80
+ * switch expression *
81
+
82
+ ## Expression-bodied Members
69
83
70
84
Use the expression body syntax when a member returns a single expression .
71
85
Move the arrow to the next line when the expression gets too long .
Original file line number Diff line number Diff line change 2
2
3
3
## Each class should go into its own file with the same name
4
4
5
- Only one class should be in a file. This also applies to an Enumerations .
6
- Inner classes are allowed but discouraged and an obvious exception to this rule.
5
+ Only one class should be in a file. This also applies to enumeration types ( ` enum ` ) .
6
+ Inner classes are allowed but discouraged.
7
7
8
8
## Each namespace should go into its own folder with the same name
9
9
You can’t perform that action at this time.
0 commit comments