Maximum Parallel Tasks

Published: December 30, 2019
csharp
var numbers = new int[]{1,2,3,4,5,6};
Parallel.ForEach(numbers, new ParallelOptions{ MaxDegreeOfParallelism = 2 }, nr => PrintNumber(nr));