Invoke Method (ParallelOptions, Action[])

Task Parallel System.Threading

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

ExceptionCondition
System..::.ArgumentNullExceptionThe exception that is thrown when the actions argument is null.
System..::.ArgumentNullExceptionThe exception that is thrown when the parallelOptions argument is null.
System..::.ArgumentExceptionThe exception that is thrown when the actions array contains a null element.
System..::.OperationCanceledExceptionThe exception that is thrown when the CancellationToken in the parallelOptions is set.
System..::.AggregateExceptionThe exception that is thrown when any action in the actions array throws an exception.
System..::.ObjectDisposedExceptionThe exception that is thrown when the the CancellationTokenSource associated with the the CancellationToken in the parallelOptions has been disposed.

See Also