December 2019
Intermediate to advanced
346 pages
9h 8m
English
Parallel.For is a variant of the sequential for loop, with the difference that the iterations run in parallel. Parallel.For returns an instance of the ParallelLoopResult class, which provides the loop competition status once the loop has finished execution. We can also check the IsCompleted and LowestBreakIteration properties of ParallelLoopResult to find out if the method has completed or canceled, or if break has been called by the users. Here are the possible scenarios:
|
IsCompleted |
LowestBreakIteration |
Reason |
|
True |
N/A |
Run to completion |
|
False |
Null |
Loop stopped pre-matching |
|
False |
Non-null integral value |
Break called on the loop |
The basic syntax of the Parallel.For method ...
Read now
Unlock full access