John Egbert John Egbert - 1 month ago 9
C# Question

Is there an equivalent to 'continue' in a Parallel.ForEach?

I am porting some code to

Parallel.ForEach
and got an error with a
continue
I have in the code. Is there something equivalent I can use in a
Parallel.ForEach
functionally equivalent to
continue
in a
foreach
loop?

Parallel.ForEach(items, parallelOptions, item =>
{
if (!isTrue)
continue;
});

Answer
return;

(the body is just a function called for each item)

Comments