Piguy Piguy - 4 months ago 38
C# Question

How to handle exceptions in Parallel.Foreach?

I have a parallel.Foreach loop in my code and I am wondering how to handle exceptions. Should I catch and handle(e.g write to log) exceptions inside the loop or should I catch aggregate exception outside - encapuslate the loop in try/catch?

Best regards


This MSDN Article should answer your question. It's pretty simple.