Answers for "c# can switch statemts use multiple variables"

C#
4

switch case in c# with multiple values

switch (value)
{
    case 1: case 2: case 3:          
        // Do Something
        break;
    case 4: case 5: case 6: 
        // Do Something
        break;
    default:
        // Do Something
        break;
}
Posted by: Guest on August-20-2020
0

switch case with 2 variables c#

switch (intVal1, strVal2, boolVal3)
{
    case (1, "hello", false):
        break;
    case (2, "world", false):
        break;
    case (2, "hello", false):
        break;
}
Posted by: Guest on January-20-2022

C# Answers by Framework

Browse Popular Code Answers by Language