Re: Can someone explain why switch syntax is the way it is?
- From: "Scott Roberts" <scott.roberts@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 13 Oct 2005 09:24:30 -0500
"Andrew Ducker" <andrew@xxxxxxxxxxxxx> wrote in message
news:1129209462.752861.88480@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> And no, this isn't a complaint about break - I'm very happy to make
> things explicit.
>
> However, why isn't the format something like:
>
> switch(myVariable)
> {
> case 1:
> {
> //Do Something
> }
> case 2:
> {
> //Do Something Else
> }
> default
> // Do Nothing at all
> }
>
> That way the 'break' is subsumed into the closing curly brackets, and
> it follows the same way of grouping commands as the rest of the
> language does.
>
> Andy D
Well, it would certainly be more "C# like" that way, but it would prevent
intentional "flow through" from one case to another. While I think such
"flow through" is a horrible, horrible idea, I'm sure someone out there
thinks it's absolutely necessary.
.
- Follow-Ups:
- Re: Can someone explain why switch syntax is the way it is?
- From: Christof Nordiek
- Re: Can someone explain why switch syntax is the way it is?
- From: Jeremy Williams
- Re: Can someone explain why switch syntax is the way it is?
- Prev by Date: Re: Converting a date string to a DateTime. Example please
- Next by Date: Re: TextBox.text = int (does boxing happen here)
- Previous by thread: Re: com interop C# GUI thread
- Next by thread: Re: Can someone explain why switch syntax is the way it is?
- Index(es):
Relevant Pages
|