// parameters.Count == 10
// actualFreeLicenses == 2
Parallel.For(0, parameters.Count, new ParallelOptions()
{
MaxDegreeOfParallelism = actualFreeLicenses
}, i =>
{
ExternalProgram(i);
}
);
When I execute the above code I notice that the value of i
passed to the ExternalProgram
method are 1 & 6, later 2 & 7, later 3 & 8 ...
If I have 14 Parameters and 2 licenses it always launch 1 & 8, later 2 & 9 ...
Is it possible to define order: first 1 & 2, later 3 & 4 etc?