WeakAsynchronousEvent Type

Asynchronous event with no arguments. The event handlers are stored as weak references, in order to not prevent the event handler instances to be garbage collected. The event handlers can be executed either parallel or serial. All functions of this class are thread safe.

Constructors

Constructor Description

WeakAsynchronousEvent()

Full Usage: WeakAsynchronousEvent()

Instance members

Instance member Description

this.InvokeParallel

Full Usage: this.InvokeParallel

Parameters:
Returns: Task A task that can be awaited for.

Invokes all event handlers in parallel.

token : CancellationToken
Returns: Task

A task that can be awaited for.

this.Subscribe

Full Usage: this.Subscribe

Parameters:

Subscribes the eventHandler to the event.

eventHandler : Func<CancellationToken, Task>

The event handler.

this.Unsubscribe

Full Usage: this.Unsubscribe

Parameters:
Returns: bool True if the event was removed; otherwise, false.

Unsubscribes the eventHandler from the event.

eventHandler : Func<CancellationToken, Task>

The event handler.

Returns: bool

True if the event was removed; otherwise, false.