I have to implement the following in a switch
statement:
switch(num)
{
case 4:
// some code ;
break;
case 3:
// some code ;
brea
If your num can't be less than zero:
public int GetSwitch(int num) { return num < 0 ? -1 : num; }
switch(GetSwitch(num))
{
case 4: // some code ; break;
case 3:// some code ; break;
case 0: // some code ; break;
case -1 :// some code ; break;
}
If it can, use some other "non-existent" number such as int.MinValue.