Answers for "c# switch case set value"

C#
0

c# switch case set value

int x = SwitchExpressionUsingGuardClause(y);

// Keywords: Switch Expressions, C# 8.0, Guard Clause
private int SwitchExpressionUsingGuardClause(int y)
{
    switch (y)
    {
        case 0: return 10;
        case 1: return 20;
        default: return 5;
    }
}
Posted by: Guest on April-21-2021

C# Answers by Framework

Browse Popular Code Answers by Language