Manages event handlers for event override advice when raise templates are specified. Provides thread-safe operations for adding/removing handlers and event invocation.
Namespace: Metalama.Framework.RunTime.Events
Assembly: Metalama.Framework.dll
Syntax
public sealed class EventBroker<TDelegate, TArgs, TState> where TDelegate : DelegateType Parameters
| Name | Description |
|---|---|
| TDelegate | The event delegate type. |
| TArgs | The event arguments type (i.e. the arguments of |
| TState | An opaque state stored by the EventBroker<TDelegate, TArgs, TState> and passed along to the IEventAdapter<TDelegate, TArgs, TState>. For instance events, typically set to the declaring type of the event. For static events, it is typically set to None. |
Properties
| Name | Description |
|---|---|
| InvocationDelegate | Gets a delegate that calls the Invoke(in TArgs) method. |
Methods
| Name | Description |
|---|---|
| AddHandler(TDelegate?) | Adds an event handler. |
| Invoke(in TArgs) | Invokes all registered event handlers. This method should be used when all delegate parameters are read-only and the delegate has a void return type. |
| InvokeByRef(ref TArgs) | Invokes all registered event handlers. This method should be used when the delegate has |
| RemoveHandler(TDelegate?) | Removes an event handler. |
Operators
| Name | Description |
|---|---|
| implicit operator TDelegate(EventBroker<TDelegate, TArgs, TState>) | Implicitly converts the broker to its delegate type. |