C# stop parallel foreach code example
Example: how to break out of parallel.foreach
Parallel.ForEach(list,
(i, state) =>
{
state.Break();
});
Parallel.ForEach(list,
(i, state) =>
{
state.Break();
});