I want to take a set of objects and run a routine on all of them. The order doesn't matter and they are each independent operations, so I thought I would call Parallel.ForEach on the collection. But I want to follow-up the whole thing once complete.
Where is the ContinueWith equivalent or an overload of ForEach that takes another action/Task to run on completion? Am I stuck polling the ParallelLoopResult.IsCompleted value until it comes back true?
The ContinueWhenAll method always expects an array of Tasks. Should I instead project the set of objects into new Tasks for each? How would I then start an array of Tasks all at once and in parallel?
This question is similar, but concerns the older 3.5 TPL Extensions I believe. I'm open to solutions outside of the Task Parallel Library if need be.
Parallel.ForEach
blocks until it's finished, so you can just do whatever you need to after the method call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With