Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

switch expression c#

var switchValue = 3;
var resultText = switchValue switch
{
    1 or 2 or 3 => "one, two, or three",
    4 => "four",
    5 => "five",
    _ => "unknown",
};
Source by www.c-sharpcorner.com #
 
PREVIOUS NEXT
Tagged: #switch #expression
ADD COMMENT
Topic
Name
9+7 =