C# 8.0 Switch expressions enable you to use more concise expression syntax. There are fewer repetitive case and break keywords, and fewer curly braces.
There are several syntax improvements here:
– The variable comes before the switch keyword.
– The case and : elements are replaced with lambda expression (arrow key).
– The default case is replaced with a _ discard.
– The bodies are expressions, not statements.