| 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.EssentialsAssembly: 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
Public Class WeakEventListener(Of TTarget As Class, TSource As Class, TEventArgs)
Implements IWeakEventListener
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 | Name | Description |
---|
| WeakEventListenerTTarget, 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.
|
| WeakEventListenerTTarget, 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.
|
TopMethods | Name | Description |
---|
| Detach |
Detaches from the subscribed event.
|
| OnEvent |
Handler for the subscribed event calls OnEventAction to handle it.
|
TopExtension Methods | Name | Description |
---|
| SafeCastT |
Performs a cast from object to T, avoiding possible null violations if T is a value type.
(Defined by ObjectExtensions) |
TopSee Also