Answers for "new 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
0

c# switch

switch(expression) {
  case x:
    // code block
    break;
  case y:
    // code block
    break;
  default:
    // code block
    break;
}
Posted by: Guest on March-16-2022

C# Answers by Framework

Browse Popular Code Answers by Language