Click here to Skip to main content
15,741,077 members

Comments by Sharp Ninja (Top 1 by date)

Sharp Ninja 27-Jul-17 8:54am View    
This is an overly simplistic use case, which is going to be subject to the body of the action being invoked through a delegate instead of falling directly into the code. On a more complex body, especially one with nested loops, then the lower overhead iterating the outer loop will be more significant. However, your answer does directly answer the OP's question than mine does with the scope of the question.

Another thing to consider is using .AsParallel and then running Parallel.ForEach() on the loop if the body of the loop is a standalone unit of work, which in this case it is. Please add that use case to your example and re-run.