In C# 8.0, the Switch statements has become more powerful with patterns. All the cases have turned into expressions and become more readable.
Following code illustrates basic usage of new switch.
var action= 1;
var result = operation switch
{
1 => "Action 1",
2 => "Action 2",
3 => "Action 3",
4 => "Action 4",
_ => "No Action performed"
};
Console.WriteLine(result );
More information can be found here.
Chaeers,
Samitha