Multiple statements in a switch expression: C# 8 [duplicate]
Your only supported choice is the func like you did. See [this article][1] for more information. His example: var result = operation switch { “+” => ((Func<int>)(() => { Log(“addition”); return a + b; }))(), “-” => ((Func<int>)(() => { Log(“subtraction”); return a – b; }))(), “/” => ((Func<int>)(() => { Log(“division”); return a / … Read more