I would like to know if there is maybe a finally
that i can use in a Parallel.ForEach
?
try
{
}
finally
{
}
Is this possible in a Parallel.ForEach
?
I need to do a finally when the loop has completed.
Parallel.ForEach(someList, x =>
{
//...
}, // Now i need to do a finally);
My problem is that i have a try finally around my Parallel.ForEach, but i dont want the finally to happen. It must only happen when the parallel task has completed.
So this does not work for me:
try
{
Parallel.ForEach(someList, x =>
{
//...
});
}
finally
{
}
Is there maybe another way of doing this?