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;
});

Answers


return;

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


When you converted your loop into a compatible definition for the Parallel.Foreach logic, you ended up making the statement body a lambda. Well, that is an action that gets called by the Parallel function.

So, replace continue with return, and break with Stop() or Break() statements.


Need Your Help

read file from external storage

android storage external readfile

I simply cannot find how to get one specified file from the external storage.

Do UTF-8, UTF-16, and UTF-32 differ in the number of characters they can store?

unicode character-encoding utf

Okay. I know this looks like the typical "Why didn't he just Google it or go to www.unicode.org and look it up?" question, but for such a simple question the answer still eludes me after checking b...