c# switch case on int code example
Example: 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;
}
}