Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

switch expression c# multiple cases

var switchValue = 3;
var resultText = switchValue switch
{
    1 or 2 or 3 => "one, two, or three",
    4 => "four",
    5 => "five",
    _ => "unknown",
};
 
PREVIOUS NEXT
Tagged: #switch #expression #multiple #cases
ADD COMMENT
Topic
Name
1+6 =