System.Threading.Tasks.Parallel.For Method

Executes a for (For in Visual Basic) loop in which iterations may run in parallel and loop options can be configured.

Syntax

public static ParallelLoopResult For (int fromInclusive, int toExclusive, ParallelOptions parallelOptions, Action<int> body)

Parameters

fromInclusive
The start index, inclusive.
toExclusive
The end index, exclusive.
parallelOptions
An object that configures the behavior of this operation.
body
The delegate that is invoked once per iteration.

Returns

A structure that contains information about which portion of the loop completed.

Remarks

The body delegate is invoked once for each value in the iteration range (fromInclusive, toExclusive). It is provided with the iteration count (int) as a parameter.

If fromInclusive is greater than or equal to toExclusive, then the method returns immediately without performing any iterations.

Requirements

Namespace: System.Threading.Tasks
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 4.0.0.0