Skip to content

Commit 3b48ae4

Browse files
author
Jan Nils Ferner
authored
Merge branch 'master' into remove-glossary
2 parents b49a61b + 6b8fbc8 commit 3b48ae4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

documentation/src/basic-constructs.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ return condition
6565
```
6666
*ternary operator*
6767

68+
## Expression-bodied members
69+
70+
Use the expression body syntax when a member returns a single expression.
71+
Move the arrow to the next line when the expression gets too long.
72+
73+
```csharp
74+
public int Length => 0;
75+
76+
public string AbsolutePath()
77+
=> Path.Combine(CalculateRootPath(), RelativePath);
78+
```
79+
*expression-bodied members*
80+
6881
## For-loops
6982

7083
Avoid for-loops and use LINQ and higher order functions as an alternative.

0 commit comments

Comments
 (0)