Re: how 2 multiple case in a switch?
From: Daniel Jin (anonymous_at_discussions.microsoft.com)
Date: 05/14/04
- Next message: John Wood: "Re: how 2 multiple case in a switch?"
- Previous message: Alvin Bruney [MVP]: "Re: Where to start the try block and what's the overhead???"
- In reply to: cody: "Re: how 2 multiple case in a switch?"
- Next in thread: Daniel Jin: "Re: how 2 multiple case in a switch?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 14 May 2004 09:11:08 -0700
yes you can. C# supports fall through from empty labels
case 1:
case 2:
case 3:
return true; break;
case 4:
return false; break;
default:
throw new Exception();
----- cody wrote: -----
You can't do that in C#.
You have to build either a tower of cases of use an "if".
--
cody
Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Garfield" <anonymous@discussions.microsoft.com> schrieb im Newsbeitrag
news:3F39CCA5-3474-407B-A8FF-70DF19E6ACE3@microsoft.com...
> I have a complex switch statement to build.
> In VB I was able to do something like this:
>> switch (cChar)
> {
> case 32 to 127, 176, 196, 198, 197, 214, 216, 181, 228, 230, 229, 246,
248:
> return true
> default:
> return false
> }
>> How do I do this without a tower of case labels?
>
- Next message: John Wood: "Re: how 2 multiple case in a switch?"
- Previous message: Alvin Bruney [MVP]: "Re: Where to start the try block and what's the overhead???"
- In reply to: cody: "Re: how 2 multiple case in a switch?"
- Next in thread: Daniel Jin: "Re: how 2 multiple case in a switch?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|