Class EventHandlerEnumerableExtensions
Contains extension methods for IAsyncEventHandler<TAsyncEvent> invocation.
public static class EventHandlerEnumerableExtensions
- Inheritance
-
objectEventHandlerEnumerableExtensions
Methods
InvokeAsync<TAsyncEvent>(IEnumerable<IAsyncEventHandler<TAsyncEvent>>, TAsyncEvent, CancellationToken)
Invokes the HandleAsync(TAsyncEvent, CancellationToken) method on all handlers.
public static Task InvokeAsync<TAsyncEvent>(this IEnumerable<IAsyncEventHandler<TAsyncEvent>> handlers, TAsyncEvent asyncEvent, CancellationToken cancellationToken) where TAsyncEvent : IAsyncEvent
Parameters
handlersIEnumerable<IAsyncEventHandler<TAsyncEvent>>Enumeration of handlers whose HandleAsync(TAsyncEvent, CancellationToken) method to invoke.
asyncEventTAsyncEventAsynchronous event passed to the handlers.
cancellationTokenCancellationTokenThe cancellation instruction.
Returns
- Task
Returns a task representing the asynchronous invocation operation.
Type Parameters
TAsyncEventType of the asynchronous event being handled.
Exceptions
- ArgumentNullException
Thrown when
handlersis null.
- See Also