Limit the number of parallel threads in C#

Assuming you’re building this with the TPL, you can set the ParallelOptions.MaxDegreesOfParallelism to whatever you want it to be.

Parallel.For for a code example.

Leave a Comment