Re: How to exit a For-Next in a nested Switch statement?
- From: "Alvin Bruney - ASP.NET MVP" <www.lulu.com/owc>
- Date: Tue, 13 Sep 2005 14:44:05 -0400
i do this too, there is convention that states that code should manipulate
the counter. if you don't care about convention, that's fine
--
Regards,
Alvin Bruney [MVP ASP.NET]
[Shameless Author plug]
The Microsoft Office Web Components Black Book with .NET
Now Available @ www.lulu.com/owc
Forth-coming VSTO.NET - Wrox/Wiley 2006
-------------------------------------------------------
"raican" <googlegroups@xxxxxxxxxxxx> wrote in message
news:1126636503.519346.173340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> hi,
>
> the way i've exited for loops in the past is to set the loop variable
> to the max so the loop drops out naturally on it's next itteration.
>
> i.e.
> for (int i=0; i<=myArray.Length; i++)
> {
> if (myArray[i] == true)
> switch (i)
> {
> case 0 :
> ... do somehting
> i = myArray.Length + 1;
> break;
> case 1 :
> ... do somehting
> i = myArray.Length + 1;
> break;
> case 2 :
> ... do somehting
> i = myArray.Length + 1;
> break;
> }
> }
>
> i've never had any problems with this method.
>
> hope this helps
> :)
>
.
- References:
- Re: How to exit a For-Next in a nested Switch statement?
- From: jgorlick
- Re: How to exit a For-Next in a nested Switch statement?
- From: raican
- Re: How to exit a For-Next in a nested Switch statement?
- Prev by Date: Re: webservices, return xml without .net injecting xml schema
- Next by Date: Search for multiple things in a string
- Previous by thread: Re: How to exit a For-Next in a nested Switch statement?
- Next by thread: Re: How to exit a For-Next in a nested Switch statement?
- Index(es):
Relevant Pages
|