Answers for "using expressions in switch case c#"

C#
4

switch expression c#

//called: switch expressions

int number= 2;

string result = number switch
{
    0 => "zero",
    1 => "one",
    2 => "two",
    _ => "default"
};

Console.WriteLine(result);
Posted by: Guest on March-16-2022

Code answers related to "using expressions in switch case c#"

C# Answers by Framework

Browse Popular Code Answers by Language