Class EventBase<TDelegate>
Provides a base container for event listeners - this is an unordered concurrent collection.
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public abstract class EventBase<TDelegate> where TDelegate : Delegate
Type Parameters
Name | Description |
---|---|
TDelegate | The delegate type. |
Constructors
EventBase()
Declaration
protected EventBase()
Fields
Listeners
Declaration
protected readonly ConcurrentDictionary<TDelegate, byte> Listeners
Field Value
Type | Description |
---|---|
ConcurrentDictionary<TDelegate, byte> |
Methods
AddListener(TDelegate)
Adds a listener to the event handler.
Declaration
public bool AddListener(TDelegate callback)
Parameters
Type | Name | Description |
---|---|---|
TDelegate | callback | The callback function. |
Returns
Type | Description |
---|---|
bool | Whether the listener could be added. |
Clear()
Clears all listeners from the event handler.
Declaration
public void Clear()
RemoveListener(TDelegate)
Removes a listener from the event handler.
Declaration
public bool RemoveListener(TDelegate callback)
Parameters
Type | Name | Description |
---|---|---|
TDelegate | callback | The callback function. |
Returns
Type | Description |
---|---|
bool | Whether the listener could be removed. |