.NET Framework Class Library |
Parallel..::.For Method (Int64, Int64, Action<(Of <(Int64, ParallelLoopState>)>)) |
Parallel Class See Also Send Feedback |
Executes a for loop in which iterations may run in parallel.
Namespace:
System.Threading.Tasks
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function For ( _ fromInclusive As Long, _ toExclusive As Long, _ body As Action(Of Long, ParallelLoopState) _ ) As ParallelLoopResult |
C# |
---|
public static ParallelLoopResult For( long fromInclusive, long toExclusive, Action<long, ParallelLoopState> body ) |
Parameters
- fromInclusive
- Type: System..::.Int64
The start index, inclusive.
- toExclusive
- Type: System..::.Int64
The end index, exclusive.
- body
- Type: System..::.Action<(Of <(Int64, ParallelLoopState>)>)
The delegate that is invoked once per iteration.
Return Value
A ParallelLoopResult structure that contains information on what 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 following parameters: the iteration count (an Int64),
and a ParallelLoopState instance that may be
used to break out of the loop prematurely.
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | The exception that is thrown when the body argument is null. |
System..::.AggregateException | The exception that is thrown to contain an exception thrown from one of the specified delegates. |