The only way I know is: run from one case into the next case by *not*
doing a "break". The code below does what you wanted in your code above.
switch(mode)
{
case Partial:
if(reader != null)
{
...
break;
}
/*FALL THROUGH*/
case Full:
...
break;
}
But you should do such things only when absolutely needed. At least put
a fat comment there, stating that you omitted the "break" on purpose and
not by accident.
Thanks, Thomas.
I wrote the following post to Chris just before reading your comment:
"If it works this way, I think that the Java switch statement flow is
unconsistent, because of the fall-through behavior (that is nothing but
a degenerate, implicit jump to a subsequent case statement!).
IMHO, fall-through is too much limitative: adding
break-to-labeled-statement statements to the switch syntax would be a
useful and elegant extension to the current simple break statement (the
same purpose of the ugly-but-effective 'go to' statement of C#). To be
used wisely and sparingly, obviously!"