Share via


TplExtensions.InvokeAsync Method

Definition

Overloads

InvokeAsync(AsyncEventHandler, Object, EventArgs)

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.

InvokeAsync<TEventArgs>(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.

InvokeAsync(AsyncEventHandler, Object, EventArgs)

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.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ InvokeAsync(Microsoft::VisualStudio::Threading::AsyncEventHandler ^ handlers, System::Object ^ sender, EventArgs ^ args);
public static System.Threading.Tasks.Task InvokeAsync (this Microsoft.VisualStudio.Threading.AsyncEventHandler handlers, object sender, EventArgs args);
public static System.Threading.Tasks.Task InvokeAsync (this Microsoft.VisualStudio.Threading.AsyncEventHandler? handlers, object? sender, EventArgs args);
static member InvokeAsync : Microsoft.VisualStudio.Threading.AsyncEventHandler * obj * EventArgs -> System.Threading.Tasks.Task
<Extension()>
Public Function InvokeAsync (handlers As AsyncEventHandler, sender As Object, args As EventArgs) As Task

Parameters

handlers
AsyncEventHandler

The event handlers. May be null.

sender
Object

The event source.

args
EventArgs

The event argument.

Returns

The task that completes when all handlers have completed.

Exceptions

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

Applies to

InvokeAsync<TEventArgs>(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.

public:
generic <typename TEventArgs>
 where TEventArgs : EventArgs[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ InvokeAsync(Microsoft::VisualStudio::Threading::AsyncEventHandler<TEventArgs> ^ handlers, System::Object ^ sender, TEventArgs args);
public:
generic <typename TEventArgs>
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task ^ InvokeAsync(Microsoft::VisualStudio::Threading::AsyncEventHandler<TEventArgs> ^ handlers, System::Object ^ sender, TEventArgs args);
public static System.Threading.Tasks.Task InvokeAsync<TEventArgs> (this Microsoft.VisualStudio.Threading.AsyncEventHandler<TEventArgs> handlers, object sender, TEventArgs args) where TEventArgs : EventArgs;
public static System.Threading.Tasks.Task InvokeAsync<TEventArgs> (this Microsoft.VisualStudio.Threading.AsyncEventHandler<TEventArgs>? handlers, object? sender, TEventArgs args);
static member InvokeAsync : Microsoft.VisualStudio.Threading.AsyncEventHandler<'EventArgs (requires 'EventArgs :> EventArgs)> * obj * 'EventArgs -> System.Threading.Tasks.Task (requires 'EventArgs :> EventArgs)
static member InvokeAsync : Microsoft.VisualStudio.Threading.AsyncEventHandler<'EventArgs> * obj * 'EventArgs -> System.Threading.Tasks.Task
<Extension()>
Public Function InvokeAsync(Of TEventArgs As EventArgs) (handlers As AsyncEventHandler(Of TEventArgs), sender As Object, args As TEventArgs) As Task
<Extension()>
Public Function InvokeAsync(Of TEventArgs) (handlers As AsyncEventHandler(Of TEventArgs), sender As Object, args As TEventArgs) As Task

Type Parameters

TEventArgs

The type of argument passed to each handler.

Parameters

handlers
AsyncEventHandler<TEventArgs>

The event handlers. May be null.

sender
Object

The event source.

args
TEventArgs

The event argument.

Returns

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

Exceptions

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

Applies to