WeakEventListener<TInstance,TSource,TEventArgs> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Implements a weak event listener that allows the owner to be garbage collected if its only remaining link is an event handler.
public sealed class WeakEventListener<TInstance,TSource,TEventArgs> where TInstance : class
type WeakEventListener<'Instance, 'Source, 'EventArgs (requires 'Instance : null)> = class
Public NotInheritable Class WeakEventListener(Of TInstance, TSource, TEventArgs)
Type Parameters
- TInstance
Type of instance listening for the event.
- TSource
Type of source for the event.
- TEventArgs
Type of event arguments for the event.
- Inheritance
-
WeakEventListener<TInstance,TSource,TEventArgs>
Constructors
WeakEventListener<TInstance,TSource,TEventArgs>(TInstance) |
Initializes a new instance of the WeakEventListener<TInstance,TSource,TEventArgs> class. |
Properties
OnDetachAction |
Gets or sets the method to call when detaching from the event. |
OnEventAction |
Gets or sets the method to call when the event fires. |
Methods
Detach() |
Detaches from the subscribed event. |
OnEvent(TSource, TEventArgs) |
Handler for the subscribed event calls OnEventAction to handle it. |