C# Parallel Loops When Does it Make Sense?


In this one I show you how to write a parallel.for loop in C# and give you an example of when it make sense to do so. For very simple operations it is typically faster to write a sequential for/foreach loop. This is of course dependent upon CPU architecture among other things but that is not what this video is about. In this one I’m just going over the basics. If you like this topic and are interested in more I can go over Parallel.Invoke, Parallel.ForEach, and maybe do a video on concurrency too.

MSDN Article:

Support the channel by getting your PC gear on Amazon with my affiliate link.

Check out my “Influencer Page”


Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe


  1. Very helpful. Would like to see the Parallel.ForEach with local variables though. I've been trying to get this to work so I can see subtotals and return a final complete total using a Parallel.Foreach over millions of items.

  2. Thanks for the explain. We are comparing different version of our web services for timing, so are running two versions simultaniously to eliminate side effects from DB access, NEtwrok traffic etc.. I needed to see how this works. Its a lot simpler than I thought!


Please enter your comment!
Please enter your name here