Parallel.For Method (Int32, Int32, ParallelOptions, Action<Int32, ParallelLoopState>)
Executes a for (For in Visual Basic) loop in which iterations may run in parallel, loop options can be configured, and the state of the loop can be monitored and manipulated.
Assembly: mscorlib (in mscorlib.dll)
public static ParallelLoopResult For( int fromInclusive, int toExclusive, ParallelOptions parallelOptions, Action<int, ParallelLoopState> body )
The start index, inclusive.
The end index, exclusive.
An object that configures the behavior of this operation.
Return ValueType: System.Threading.Tasks.ParallelLoopResult
A structure that contains information about which portion of the loop completed.
The CancellationToken in the parallelOptions argument is canceled.
The body argument is null.
The parallelOptions argument is null.
The exception that contains all the individual exceptions thrown on all threads.
The body delegate is invoked once for each value in the iteration range (fromInclusive, toExclusive). It is provided with the following parameters: the iteration count (Int32), and a ParallelLoopState instance that may be used to break out of the loop prematurely.
If fromInclusive is greater than or equal to toExclusive, the method returns immediately without performing any iterations.
Available since 8
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Available since 8.1