Class EventObserver
EventObserver is designed to help manage event handlers by detatching when disposed. Creating this object will also attach in the constructor.
public sealed class EventObserver : IDisposable
- Inheritance
-
EventObserver
- Implements
- Inherited Members
- Extension Methods
Constructors
EventObserver(EventInfo, object, Delegate)
Creates an instance of EventObserver and attaches to the supplied event on the supplied target. Call dispose to detach.
public EventObserver(EventInfo eventInfo, object target, Delegate handler)
Parameters
eventInfo
EventInfoThe event to attach and detach from.
target
objectThe target object the event is defined on. Null if the method is static.
handler
DelegateThe delegate to attach to the event.
Methods
Dispose()
Detaches the handler from the event.
public void Dispose()