Click or drag to resize

WeakEventListenerTTarget, TSource, TEventArgs Class

Implements a weak event listener that allows the owner to be garbage collected if its only remaining link is an event handler.
Inheritance Hierarchy
SystemObject
  TomsToolbox.EssentialsWeakEventListenerTTarget, TSource, TEventArgs

Namespace:  TomsToolbox.Essentials
Assembly:  TomsToolbox.Essentials (in TomsToolbox.Essentials.dll)
Syntax
public class WeakEventListener<TTarget, TSource, TEventArgs> : IWeakEventListener
where TTarget : class
where TSource : class

Type Parameters

TTarget
Type of the target instance listening for the event.
TSource
Type of source instance for the event.
TEventArgs
Type of event arguments for the event.

The WeakEventListenerTTarget, TSource, TEventArgs type exposes the following members.

Constructors
  NameDescription
Public methodWeakEventListenerTTarget, TSource, TEventArgs(TTarget, TSource, ActionTTarget, Object, TEventArgs, ActionWeakEventListenerTTarget, TSource, TEventArgs, TSource, ActionWeakEventListenerTTarget, TSource, TEventArgs, TSource)
Initializes a new instances of the WeakEventListener class that references the source but not the target.
Public methodWeakEventListenerTTarget, TSource, TEventArgs(TTarget, WeakReferenceTSource, ActionTTarget, Object, TEventArgs, ActionWeakEventListenerTTarget, TSource, TEventArgs, TSource, ActionWeakEventListenerTTarget, TSource, TEventArgs, TSource)
Initializes a new instances of the WeakEventListener class that does not reference both source and target.
Top
Methods
  NameDescription
Public methodDetach
Detaches from the subscribed event.
Public methodOnEvent
Handler for the subscribed event calls OnEventAction to handle it.
Top
Extension Methods
See Also