I have to implement the following in a switch statement:
switch
switch(num) { case 4: // some code ; break; case 3: // some code ; brea
Note: the answer below was written in 2009. Switch patterns were introduced in C# 7.
You can't - switch/case is only for individual values. If you want to specify conditions, you need an "if":
if (num < 0) { ... } else { switch(num) { case 0: // Code case 1: // Code case 2: // Code ... } }