Switch Expressions (C# 8+)
Switch expressions provide a more concise syntax.
int day = 2;string dayType = dayswitch{ 1 or 7 => "Weekend", _ => "Weekday"};Console.WriteLine(dayType);Run the Application
Section titled “Run the Application”dotnet runResult
Section titled “Result”Weekday