📜  c# switch case 设置值 - C# 代码示例

📅  最后修改于: 2022-03-11 14:48:49.211000             🧑  作者: Mango

代码示例1
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;
    }
}