An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Hi karthikeyanmuthusamy-5280,
When you perform any batch tasks, Parallel.foreach is a better choice.
Parallel.ForEach loop in C# runs upon multiple threads and processing takes place in a parallel way. Its execution is faster than foreach in most of the cases.
Parallel.ForEach loop is not a basic feature of C# and it is available from C# 4.0 and above.
More details please refer to the following links
Parallel.ForEach Method
How can I convert this foreach code to Parallel.ForEach?
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.