Table of Contents

Class EventExtensions

Namespace
Executables.Events
Assembly
executables.dll

Extension methods for publishing to and subscribing to events.

public static class EventExtensions
Inheritance
EventExtensions
Inherited Members

Methods

Publish(IEvent<Unit>)

Publishes a notification.

public static void Publish(this IEvent<Unit> e)

Parameters

e IEvent<Unit>

Event to publish to.

Subscribe(IEvent<Unit>, Action)

Subscribes a parameterless action to a unit event.

public static IDisposable Subscribe(this IEvent<Unit> e, Action action)

Parameters

e IEvent<Unit>

Event to subscribe to.

action Action

Action executed for each publication.

Returns

IDisposable

Disposable subscription handle.

Exceptions

ArgumentNullException

action is null.

SubscribeOnce(IEvent<Unit>, Action)

Subscribes a parameterless action that is invoked at most once.

public static void SubscribeOnce(this IEvent<Unit> e, Action action)

Parameters

e IEvent<Unit>

Event to subscribe to.

action Action

Action executed for the first publication.

Exceptions

ArgumentNullException

action is null.

SubscribeOnce<T>(IEvent<T>, ISubscriber<T>)

Subscribes a subscriber that is invoked at most once.

public static void SubscribeOnce<T>(this IEvent<T> e, ISubscriber<T> subscriber)

Parameters

e IEvent<T>

Event to subscribe to.

subscriber ISubscriber<T>

Subscriber invoked for the first published value.

Type Parameters

T

Type of published event value.

Exceptions

ArgumentNullException

subscriber is null.

SubscribeOnce<T>(IEvent<T>, Action<T>)

Subscribes an action that is invoked at most once.

public static void SubscribeOnce<T>(this IEvent<T> e, Action<T> action)

Parameters

e IEvent<T>

Event to subscribe to.

action Action<T>

Action executed for the first published value.

Type Parameters

T

Type of published event value.

Exceptions

ArgumentNullException

action is null.

Subscribe<T>(IEvent<T>, Action<T>)

Subscribes an action to an event.

public static IDisposable Subscribe<T>(this IEvent<T> e, Action<T> action)

Parameters

e IEvent<T>

Event to subscribe to.

action Action<T>

Action executed for each published value.

Returns

IDisposable

Disposable subscription handle.

Type Parameters

T

Type of published event value.

Exceptions

ArgumentNullException

action is null.