System.Threading.Tasks.Parallel.For Method

Executes a for (For in Visual Basic) loop in which iterations may run in parallel.

Syntax

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

Parameters

fromInclusive
The start index, inclusive.
toExclusive
The end index, exclusive.
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, the method returns immediately without performing any iterations.

Requirements

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