The embedded statements continue to execute for each element in the array or collection. After the iteration has been completed for all the elements in the collection, control is transferred to the next statement following the foreach block.
At any point within the foreach block, you can break out of the loop using the break keyword, or step directly to the next iteration in the loop by using the continue keyword.
A foreach loop can also be exited by the goto, return, or throwstatements.
For more information on the foreach keyword and code samples, see the following topics:
Using foreach with Arrays (C# Programming Guide)
How to: Access a Collection Class with foreach (C# Programming Guide)