Check out example codes for "get out of foreach statement c#". It will help you in understanding the concepts better.

Code Example 1

foreach (string s in sList)
{
    if (s.equals("ok"))
    {
        break; // get out of the loop
    }
}

Learn ReactJs, React Native from akashmittal.com