📜  C# 开关和大小写 - C# 代码示例

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

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