Class Event<T>
An implementation of the IExiledEvent interface that encapsulates an event with arguments.
Inheritance
Implements
Inherited Members
Namespace: Exiled.Events.Features
Assembly: Exiled.Events.dll
Syntax
public class Event<T> : IExiledEvent
Type Parameters
Name | Description |
---|---|
T | The specified System.EventArgs that the event will use. |
Constructors
| Improve this Doc View SourceEvent()
Initializes a new instance of the Event<T> class.
Declaration
public Event()
Properties
| Improve this Doc View SourceDictionary
Gets a System.Collections.Generic.IReadOnlyCollection<T> of Event<T> which contains all the Event<T> instances.
Declaration
public static IReadOnlyDictionary<Type, Event<T>> Dictionary { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IReadOnlyDictionary<System.Type, Event<T>> |
Methods
| Improve this Doc View SourceInvokeSafely(T)
Executes all CustomEventHandler<TEventArgs> listeners safely.
Declaration
public void InvokeSafely(T arg)
Parameters
Type | Name | Description |
---|---|---|
T | arg | The event argument. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Event or its arg is null. |
Subscribe(CustomAsyncEventHandler<T>)
Subscribes a target CustomAsyncEventHandler<TEventArgs> to the inner event if the conditional is true.
Declaration
public void Subscribe(CustomAsyncEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
CustomAsyncEventHandler<T> | handler | The handler to add. |
Subscribe(CustomEventHandler<T>)
Subscribes a target CustomEventHandler<TEventArgs> to the inner event if the conditional is true.
Declaration
public void Subscribe(CustomEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
CustomEventHandler<T> | handler | The handler to add. |
Unsubscribe(CustomAsyncEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event if the conditional is true.
Declaration
public void Unsubscribe(CustomAsyncEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
CustomAsyncEventHandler<T> | handler | The handler to add. |
Unsubscribe(CustomEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event if the conditional is true.
Declaration
public void Unsubscribe(CustomEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
CustomEventHandler<T> | handler | The handler to add. |
Operators
| Improve this Doc View SourceAddition(Event<T>, CustomAsyncEventHandler<T>)
Subscribes a CustomAsyncEventHandler to the inner event, and checks patches if dynamic patching is enabled.
Declaration
public static Event<T> operator +(Event<T> event, CustomAsyncEventHandler<T> asyncEventHandler)
Parameters
Type | Name | Description |
---|---|---|
Event<T> | event | The Event<T> to subscribe the CustomAsyncEventHandler<TEventArgs> to. |
CustomAsyncEventHandler<T> | asyncEventHandler | The CustomAsyncEventHandler<TEventArgs> to subscribe to the Event<T>. |
Returns
Type | Description |
---|---|
Event<T> | The Event<T> with the handler added to it. |
Addition(Event<T>, CustomEventHandler<T>)
Subscribes a target CustomEventHandler<TEventArgs> to the inner event and checks if patching is possible, if dynamic patching is enabled.
Declaration
public static Event<T> operator +(Event<T> event, CustomEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
Event<T> | event | The Event<T> the CustomEventHandler<TEventArgs> will be subscribed to. |
CustomEventHandler<T> | handler | The CustomEventHandler<TEventArgs> that will be subscribed to the Event<T>. |
Returns
Type | Description |
---|---|
Event<T> | The Event<T> with the handler subscribed to it. |
Subtraction(Event<T>, CustomAsyncEventHandler<T>)
Unsubscribes a target CustomAsyncEventHandler<TEventArgs> from the inner event, and checks if unpatching is possible, if dynamic patching is enabled.
Declaration
public static Event<T> operator -(Event<T> event, CustomAsyncEventHandler<T> asyncEventHandler)
Parameters
Type | Name | Description |
---|---|---|
Event<T> | event | The Event the CustomAsyncEventHandler<TEventArgs> will be unsubscribed from. |
CustomAsyncEventHandler<T> | asyncEventHandler | The CustomAsyncEventHandler<TEventArgs> that will be unsubscribed from the Event<T>. |
Returns
Type | Description |
---|---|
Event<T> | The Event<T> with the handler unsubscribed from it. |
Subtraction(Event<T>, CustomEventHandler<T>)
Unsubscribes a target CustomEventHandler<TEventArgs> from the inner event and checks if unpatching is possible, if dynamic patching is enabled.
Declaration
public static Event<T> operator -(Event<T> event, CustomEventHandler<T> handler)
Parameters
Type | Name | Description |
---|---|---|
Event<T> | event | The Event<T> the CustomEventHandler<TEventArgs> will be unsubscribed from. |
CustomEventHandler<T> | handler | The CustomEventHandler<TEventArgs> that will be unsubscribed from the Event<T>. |
Returns
Type | Description |
---|---|
Event<T> | The Event<T> with the handler unsubscribed from it. |