@@ -74,7 +74,7 @@ return condition
74
74
75
75
## Switch Expression
76
76
77
- Prefer switch expressions over switch statements.
77
+ Prefer [ switch expressions] over switch statements.
78
78
79
79
``` csharp
80
80
return animalKind switch
@@ -86,9 +86,11 @@ return animalKind switch
86
86
```
87
87
* switch expression *
88
88
89
+ [switch expressions ]: https :// docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/switch-expression
90
+
89
91
## Expression-bodied Members
90
92
91
- Use the expression body syntax when a member returns a single expression .
93
+ Use the [ expression body syntax ] when a member returns a single expression .
92
94
Move the arrow to the next line when the expression gets too long .
93
95
94
96
```csharp
@@ -99,6 +101,8 @@ public string AbsolutePath()
99
101
```
100
102
* expression - bodied members *
101
103
104
+ [expression body syntax ]: https : // docs.microsoft.com/en-us/dotnet/csharp/programming-guide/statements-expressions-operators/expression-bodied-members
105
+
102
106
## For-loops
103
107
104
108
Avoid for - loops and use LINQ and higher order functions as an alternative .
@@ -119,8 +123,10 @@ foreach (var value in values.OrderByDescending(v => v))
119
123
120
124
### Handle all cases
121
125
122
- Unhandled cases lead the program into an undefined state . If you have no natural default case , declare one throwing a System .NotImplementedException .
126
+ Unhandled cases lead the program into an undefined state . If you have no natural default case , declare one throwing a [System .NotImplementedException ].
127
+
128
+ [System .NotImplementedException ]: https :// docs.microsoft.com/en-us/dotnet/api/system.notimplementedexception
123
129
124
130
## Goto
125
131
126
- The goto statement is forbidden in all cases .
132
+ The goto statement is forbidden in all cases .
0 commit comments