A simple google search yeilded the following result:
https://msdn.microsoft.com/en-us/library/dd460713%28v=vs.110%29.aspx
You want to use Parallel.For
, and that link gives you a detailed example.
More Related Contents:
- What is the difference between asynchronous programming and multithreading?
- How to abort a Task like aborting a Thread (Thread.Abort method)?
- Why should I prefer single ‘await Task.WhenAll’ over multiple awaits?
- No ConcurrentList in .Net 4.0?
- Does Parallel.ForEach limit the number of active threads?
- How to put a task to sleep (or delay) in C# 4.0?
- How to run unit tests (MSTest) in parallel?
- How expensive is the lock statement?
- Do the new C# 5.0 ‘async’ and ‘await’ keywords use multiple cores?
- Parallel Sort Algorithm
- Limit the number of parallel threads in C#
- Accelerating bitmap grayscale conversion, is OpenMP an option in C#?
- Parallel.For(): Update variable outside of loop
- Process files concurrently and asynchronously
- Why is Parallel.ForEach much faster then AsParallel().ForAll() even though MSDN suggests otherwise?
- Design help for parallel processing Azure blob and bulk copy to SQL database
- Is this use of Parallel.ForEach() thread safe?
- Simplest way to run three methods in parallel in C#
- Parallel.ForEach with adding to list
- Should thread-safe class have a memory barrier at the end of its constructor?
- Parallel doesnt work with Entity Framework
- .net Core Parallel.ForEach issues
- Break parallel.foreach?
- increment a count value outside parallel.foreach scope
- How to properly parallelise job heavily relying on I/O
- Are C# structs thread safe?
- Partition: How to add a wait after every partition
- Wait for QueueUserWorkItem to Complete
- Run async method 8 times in parallel
- How can i convert English digits to Arabic digits?