What is the difference between:
Parallel.ForEach(sometasks, x => x.Wait());
and
Task.WaitAll(sometasks);
EDIT:
Well I am not fully sure why I included Parallel into the question :/ ... What I had in mind was:
foreach(Task task in someTasks)
{
task.Wait();
}
but I just included Parallel.ForEach thinking it is the same thing, while of course its not --- it spawns a thread for each task to wait, which is big overhead.
Parallel.ForEach(sometasks, x => x.Wait());
Doesn't makes sense for me – Sriram Sakthivel Mar 4 at 14:41