LANGUAGE
switch expression
Produces the first matching arm result whose guard succeeds. A final discard arm can make matching exhaustive.
Formal Syntax & Structure
csharp syntaxcsharp
value switch { pattern => result, _ => fallback }Working Example
Example Snippetcsharp
int fee = "local" switch { "local" => 5, _ => 9 };