switch statement
-
:wtf: Doesn't the switch statement in C# support multiple options inside the case clause??? I'm sorry if I missed it.
-
:wtf: Doesn't the switch statement in C# support multiple options inside the case clause??? I'm sorry if I missed it.
No, but you can use empty case labels to achieve this. Example switch (x) { case 1: case 2: DoOneAndTwo; break; }
-
:wtf: Doesn't the switch statement in C# support multiple options inside the case clause??? I'm sorry if I missed it.
-
blackjack2150 wrote:
multiple options inside the case clause???
:confused: What do you mean?? Another switch case statement??
Smile: A curve that can set a lot of things straight! (\ /) (O.o) (><)
I mean something like this: switch(DayOfWeek) { case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" : work = true; case "Saturday", "Sunday": party = true; } VB .NET for example has it and that's quite sad for me, as I've preferred C# over VB.
-
I mean something like this: switch(DayOfWeek) { case "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" : work = true; case "Saturday", "Sunday": party = true; } VB .NET for example has it and that's quite sad for me, as I've preferred C# over VB.
switch (DayOfWeek) { case DayOfWeek.Monday: case DayOfWeek.Tuesday: case DayOfWeek.Wednesday: case DayOfWeek.Thursday: case DayOfWeek.Friday: work = true; break; case DayOfWeek.Saturday: case DayOfWeek.Sunday: party = true; break; }
well, it works for me... think you may be doing something wrongMy second computer is your linux box.