Skip to content

Commit 2a34003

Browse files
committed
Consistent curly use in .net from framework to 10
1 parent ffae9f6 commit 2a34003

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Site/Posts/dotnet_from_framework_to_10.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,7 @@ sum (x:xs) = x + sum xs
666666
Is also equivalent in C#:
667667

668668
```csharp
669-
public static int Sum(IEnumerable<int> l) => l switch
670-
{
669+
public static int Sum(IEnumerable<int> l) => l switch {
671670
[] => 0,
672671
[var x, .. var xs] => x + Sum(xs),
673672
};
@@ -700,8 +699,7 @@ evaluate (Add a b) = evaluate a + evaluate b
700699
Since `Expression` is closed in Haskell we will have no problems detected by the compiler, but C# needs an extra line:
701700

702701
```csharp
703-
public static int Evaluate(Expression e) => e switch
704-
{
702+
public static int Evaluate(Expression e) => e switch {
705703
Const c => c.Value,
706704
Add(var l, var r) => Evaluate(l) + Evaluate(r),
707705
_ => throw new ArgumentException("Unknown expression")

0 commit comments

Comments
 (0)