Thanks Ed,
I expected the explanation to be the same, but I cannot agree with the
rationale behind it, i.e. making it obvious for C/C++ programmers. Since I
was coming from C/C++ background (7+ years), I assumed that switches in C#
allowed fall-through (since I knew that there were break statements).
Thinking logically, I thought that if you had a break statement, there must
have been an option to fall through. Although, after the first compiler
error, I figured out that my assumption was wrong, so if there are C/C++
programmers who were supposed to benefit from the redundancy, I am not one
of them. In my mind, it is a miss (not the best design decision) and for
every argument for it, I can probably give an argument against. Not a reason
to start religious war, though. There are many issues which are more
serious. ;-)
Alek
"Ed Courtenay" <my***********@edcourtenay.co.uk> wrote in message
news:uE**************@TK2MSFTNGP12.phx.gbl...
Have a look at
http://groups.google.co.uk/groups?q=...phx.gbl&rnum=1 (watch for line wrapping) for an explanation
"Alek Davis" <alek_xDOTx_davis_xATx_intel_xDOTx_com> wrote in message
news:uR**************@tk2msftngp13.phx.gbl... Which kind of makes break statements redundant (I mean, if you cannot
fall through, what is the purpose of the break?)...
Alek
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Ruslan Shlain <rs*****@hotmail.com> wrote:
> Whats wrong with this code?
You're missing break statements. You aren't allowed to fall through
(except through empty cases statements) in C#.
<snip>
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too