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
Post a Comment