Class Event<T>
An implementation of the IExiledEvent interface that encapsulates an event with arguments.
public class Event<T> : IExiledEvent
Type Parameters
T
The specified EventArgs that the event will use.
- Inheritance
-
Event<T>
- Implements
- Inherited Members
- Extension Methods
Constructors
Event()
Initializes a new instance of the Event<T> class.
public Event()
Properties
Dictionary
Gets a IReadOnlyCollection<T> of Event<T> which contains all the Event<T> instances.
public static IReadOnlyDictionary<Type, Event<T>> Dictionary { get; }
Property Value
- IReadOnlyDictionary<Type, Event<T>>
Methods
InvokeSafely(T)
Executes all CustomEventHandler<TEventArgs> listeners safely.
public void InvokeSafely(T arg)
Parameters
arg
TThe event argument.
Exceptions
- ArgumentNullException
Event or its arg is null.
Subscribe(CustomAsyncEventHandler<T>)
Subscribes a target CustomAsyncEventHandler<TEventArgs> to the inner event if the conditional is true.
public void Subscribe(CustomAsyncEventHandler<T> handler)
Parameters
handler
CustomAsyncEventHandler<T>The handler to add.
Subscribe(CustomEventHandler<T>)
Subscribes a target CustomEventHandler<TEventArgs> to the inner event if the conditional is true.
public void Subscribe(CustomEventHandler<T> handler)
Parameters
handler
CustomEventHandler<T>The handler to add.
Unsubscribe(CustomAsyncEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event if the conditional is true.
public void Unsubscribe(CustomAsyncEventHandler<T> handler)
Parameters
handler
CustomAsyncEventHandler<T>The handler to add.
Unsubscribe(CustomEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event if the conditional is true.
public void Unsubscribe(CustomEventHandler<T> handler)
Parameters
handler
CustomEventHandler<T>The handler to add.
Operators
operator +(Event<T>, CustomAsyncEventHandler<T>)
Subscribes a CustomAsyncEventHandler to the inner event, and checks patches if dynamic patching is enabled.
public static Event<T> operator +(Event<T> @event, CustomAsyncEventHandler<T> asyncEventHandler)
Parameters
event
Event<T>The Event<T> to subscribe the CustomAsyncEventHandler<TEventArgs> to.
asyncEventHandler
CustomAsyncEventHandler<T>The CustomAsyncEventHandler<TEventArgs> to subscribe to the Event<T>.
Returns
operator +(Event<T>, CustomEventHandler<T>)
Subscribes a target CustomEventHandler<TEventArgs> to the inner event and checks if patching is possible, if dynamic patching is enabled.
public static Event<T> operator +(Event<T> @event, CustomEventHandler<T> handler)
Parameters
event
Event<T>The Event<T> the CustomEventHandler<TEventArgs> will be subscribed to.
handler
CustomEventHandler<T>The CustomEventHandler<TEventArgs> that will be subscribed to the Event<T>.
Returns
operator -(Event<T>, CustomAsyncEventHandler<T>)
Unsubscribes a target CustomAsyncEventHandler<TEventArgs> from the inner event, and checks if unpatching is possible, if dynamic patching is enabled.
public static Event<T> operator -(Event<T> @event, CustomAsyncEventHandler<T> asyncEventHandler)
Parameters
event
Event<T>The Event the CustomAsyncEventHandler<TEventArgs> will be unsubscribed from.
asyncEventHandler
CustomAsyncEventHandler<T>The CustomAsyncEventHandler<TEventArgs> that will be unsubscribed from the Event<T>.
Returns
operator -(Event<T>, CustomEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event and checks if unpatching is possible, if dynamic patching is enabled.
public static Event<T> operator -(Event<T> @event, CustomEventHandler<T> handler)
Parameters
event
Event<T>The Event<T> the CustomEventHandler<TEventArgs> will be unsubscribed from.
handler
CustomEventHandler<T>The CustomEventHandler<TEventArgs> that will be unsubscribed from the Event<T>.