How to break nested foreach loop then go to parent foreach loop on c# -


i have following code:

foreach(// condition here) {     while (// condition here)     {         foreach (// condition here)         {              if (// condition again)              {                   //do code              }              if (// condition again)              {                  //stop first foreach go first foreach              }         }     } } 

what want when hit 2nd if statement on last foreach loop return on first foreach loop.

note: if 2nd if statement not true, should continue last foreach loop until condition not true.

thanks in advance!

the way directly goto.

another (better) option restructure until problem goes away. instance putting inner code (while + foreach) in method , use return back.


Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -