TplExtensions::InvokeAsync<TEventArgs> Method (AsyncEventHandler<TEventArgs>^, Object^, TEventArgs)

 

Invokes asynchronous event handlers, returning a task that completes when all event handlers have been invoked. Each handler is fully executed (including continuations) before the next handler in the list is invoked.

Namespace:   Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

public:
generic<typename TEventArgs>
where TEventArgs : EventArgs
[ExtensionAttribute]
static Task^ InvokeAsync(
	AsyncEventHandler<TEventArgs>^ handlers,
	Object^ sender,
	TEventArgs args
)

Parameters

handlers
Type: Microsoft.VisualStudio.Threading::AsyncEventHandler<TEventArgs>^

The event handlers. May be null.

sender
Type: System::Object^

The event source.

args
Type: TEventArgs

The event argument.

Return Value

Type: System.Threading.Tasks::Task^

A Task that completes when all handlers have completed. The task is faulted if any handlers throw an exception.

Type Parameters

TEventArgs

Exception Condition
AggregateException

Thrown if any handlers fail. It contains a collection of all failures.

Return to top
Show: