Table of Contents

Class Event<TEvent>

Namespace
RisingV.Shared.Events
Assembly
RisingV.Shared.dll

Represents a generic event that can be used to subscribe to specific event types.

public abstract record Event<TEvent> : Event, IEvent, IEquatable<Event>, IEquatable<Event<TEvent>> where TEvent : IEvent

Type Parameters

TEvent
Inheritance
Event<TEvent>
Implements
IEquatable<Event<TEvent>>
Derived
Inherited Members
Extension Methods

Methods

Subscribe(EventHandler<TEvent>)

Unsubscribes from an event using the specified owner and action handler.

public static IDisposable Subscribe(EventHandler<TEvent> handler)

Parameters

handler EventHandler<TEvent>

The action handler to be removed from the subscription.

Returns

IDisposable

Returns true if the handler was successfully unsubscribed; otherwise, false.

Subscribe(Action<TEvent>)

Subscribes to an event with an action handler.

public static IDisposable Subscribe(Action<TEvent> handler)

Parameters

handler Action<TEvent>

The action handler to be invoked when the event is raised.

Returns

IDisposable

An IDisposable that can be used to unsubscribe from the event.

Subscribe(Func<TEvent, ValueTask>)

Subscribes to an event with an asynchronous handler.

public static IDisposable Subscribe(Func<TEvent, ValueTask> handler)

Parameters

handler Func<TEvent, ValueTask>

The asynchronous event handler to be invoked when the event is raised.

Returns

IDisposable

An IDisposable that can be used to unsubscribe from the event.

Subscribe(object, EventHandler<TEvent>)

Subscribes to an event with a specific owner and handler.

public static IDisposable Subscribe(object owner, EventHandler<TEvent> handler)

Parameters

owner object

The owner of the event subscription, used to unsubscribe by owner.

handler EventHandler<TEvent>

The event handler to be invoked when the event is raised.

Returns

IDisposable

An IDisposable that can be used to unsubscribe from the event.

Subscribe(object, Action<TEvent>)

Subscribes to an event with a specific owner and action handler.

public static IDisposable Subscribe(object owner, Action<TEvent> handler)

Parameters

owner object

The owner of the event subscription, used to unsubscribe by owner.

handler Action<TEvent>

The action handler to be invoked when the event is raised.

Returns

IDisposable

An IDisposable that can be used to unsubscribe from the event.

Subscribe(object, Func<TEvent, ValueTask>)

Subscribes to an event with a specific owner and asynchronous handler.

public static IDisposable Subscribe(object owner, Func<TEvent, ValueTask> handler)

Parameters

owner object

The owner of the event subscription, used to unsubscribe by owner.

handler Func<TEvent, ValueTask>

The asynchronous event handler to be invoked when the event is raised.

Returns

IDisposable

An IDisposable that can be used to unsubscribe from the event.

Unsubscribe(EventHandler<TEvent>)

Unsubscribes from an event using the specified handler.

public static void Unsubscribe(EventHandler<TEvent> handler)

Parameters

handler EventHandler<TEvent>

The event handler to be removed from the subscription.

Unsubscribe(Action<TEvent>)

Unsubscribes from an event using the specified asynchronous handler.

public static void Unsubscribe(Action<TEvent> handler)

Parameters

handler Action<TEvent>

The asynchronous event handler to be removed from the subscription.

Unsubscribe(object, EventHandler<TEvent>)

Unsubscribes from an event using the specified owner and handler.

public static void Unsubscribe(object owner, EventHandler<TEvent> handler)

Parameters

owner object

The owner of the event subscription, used to unsubscribe by owner.

handler EventHandler<TEvent>

The event handler to be removed from the subscription.