.NET Framework Class Library |
Parallel..::.Invoke Method (ParallelOptions, array<Action>[]()[]) |
Parallel Class See Also Send Feedback |
Executes each of the provided actions, possibly in parallel.
Namespace:
System.Threading.Tasks
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Sub Invoke ( _ parallelOptions As ParallelOptions, _ ParamArray actions As Action() _ ) |
C# |
---|
public static void Invoke( ParallelOptions parallelOptions, params Action[] actions ) |
Parameters
- parallelOptions
- Type: System.Threading.Tasks..::.ParallelOptions
A ParallelOptions instance that configures the behavior of this operation.
- actions
- Type: array<
System..::.Action
>[]()[]
An array of Actions to execute.
Remarks
This method can be used to execute a set of operations, potentially in parallel.
No guarantees are made about the order in which the operations execute or whether
the they execute in parallel. This method does not return until each of the
provided operations has completed, regardless of whether completion
occurs due to normal or exceptional termination.
Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | The exception that is thrown when the actions argument is null. |
System..::.ArgumentNullException | The exception that is thrown when the parallelOptions argument is null. |
System..::.ArgumentException | The exception that is thrown when the actions array contains a null element. |
System..::.OperationCanceledException | The exception that is thrown when the CancellationToken in the parallelOptions is set. |
System..::.AggregateException | The exception that is thrown when any action in the actions array throws an exception. |
System..::.ObjectDisposedException | The exception that is thrown when the the CancellationTokenSource associated with the the CancellationToken in the parallelOptions has been disposed. |