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 Integer, _
toExclusive As Integer, _
body As Action(Of Integer) _
) As ParallelLoopResult |
C# |
---|
public static ParallelLoopResult For(
int fromInclusive,
int toExclusive,
Action<int> body
) |
Parameters
- fromInclusive
- Type: System..::.Int32
The start index, inclusive.
- toExclusive
- Type: System..::.Int32
The end index, exclusive.
- body
- Type: System..::.Action<(Of <(Int32>)>)
The delegate that is invoked once per iteration.
Return Value
A
ParallelLoopResult structure
that contains information on what portion of the loop completed.
Remarks
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. |
See Also