Class EventDictionaryBase<TKey, TEvent, TDelegate>
Provides a base container for a dictionary of events.
Inheritance
EventDictionaryBase<TKey, TEvent, TDelegate>
Inherited Members
Namespace: LemonEdge.Utils
Assembly: LemonEdge.Utils.dll
Syntax
public abstract class EventDictionaryBase<TKey, TEvent, TDelegate> where TEvent : EventBase<TDelegate>, new() where TDelegate : Delegate
Type Parameters
| Name | Description |
|---|---|
| TKey | The key type. |
| TEvent | The asynchronous event type. |
| TDelegate | The delegate type. |
Constructors
EventDictionaryBase()
Declaration
protected EventDictionaryBase()
Fields
Listeners
Declaration
protected readonly ConcurrentDictionary<TKey, TEvent> Listeners
Field Value
| Type | Description |
|---|---|
| ConcurrentDictionary<TKey, TEvent> |
Methods
AddListener(TKey, TDelegate)
Adds a listener to the event dictionary handler.
Declaration
public bool AddListener(TKey key, TDelegate callback)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key value. |
| TDelegate | callback | The callback function. |
Returns
| Type | Description |
|---|---|
| bool | Whether the listener could be added. |
Clear(TKey)
Clears the keyed listeners from the event handler.
Declaration
public void Clear(TKey key)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key value. |
RemoveListener(TKey, TDelegate)
Removes a listener from the event dictionary handler.
Declaration
public bool RemoveListener(TKey key, TDelegate callback)
Parameters
| Type | Name | Description |
|---|---|---|
| TKey | key | The key value. |
| TDelegate | callback | The callback function. |
Returns
| Type | Description |
|---|---|
| bool | Whether the listener could be added. |