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) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
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
Methods
 NameDescription
Public methodDetach Detaches from the subscribed event.
Public methodOnEvent Handler for the subscribed event calls OnEventAction to handle it.
Top
Extension Methods
 NameDescription
Public Extension MethodSafeCastT Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions)
Top
See Also