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

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

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

javascript - Chart.js - setting tooltip z-index -