How can I execute Parallel.ForEach upon completion?

I want to take a set of objects and run a routine for all of them. The order does not matter, and they are independent operations, so I thought we would call Parallel . ForEach in the collection. But I want to follow all this after completion.

Where is ContinueWith the equivalent or ForEach overload that performs another action / task to run upon completion? I closed the ParallelLoopResult poll. IsCompleted until true returns?

The ContinueWhenAll method always expects an array of Jobs. Should I instead design a set of objects into new tasks for each? How could I then run an array of tasks simultaneously and in parallel?

This question is similar, but concerns the older 3.5 TPL extensions that I consider. If necessary, I am open to solutions outside the parallel task library.

+4
source share
1 answer

Parallel.ForEach blocked until it completes, so you can just do whatever you need after calling the method.

+8
source

All Articles