Re: Funny loop with post-increment.
Jon Skeet <[email protected]> Tue, 19 Feb 2008 12:01:17 +0000
| Newsgroups | gmane.comp.windows.devel.dotnet.clr |
|---|---|
| Message-ID | <[email protected]> |
silky wrote:
>> No, it's not.
>
> Yes it is. What if I want to do nothing in case 1, print in case 2,
> and do something in the default case? How do I do it without break?
Two options:
1) Don't include the case
2) Use a pair of empty braces, just like you would if you wanted to do
nothing in a catch block:
switch (n)
{
case 1:
{
}
case 2:
{
Console.WriteLine("Foo");
}
default:
{
// Whatever
}
}
Jon
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com