Table of Contents

Class WeakReferenceEventListener<TInstance, TSource>

Namespace
MADE.Runtime
Assembly
MADE.Runtime.dll

Defines a model for providing a weak referenced event listener.

public sealed class WeakReferenceEventListener<TInstance, TSource> where TInstance : class

Type Parameters

TInstance

The instance type for the listener.

TSource

The source type.

Inheritance
WeakReferenceEventListener<TInstance, TSource>
Inherited Members
Extension Methods

Constructors

WeakReferenceEventListener(TInstance)

Initializes a new instance of the WeakReferenceEventListener<TInstance, TSource> class.

public WeakReferenceEventListener(TInstance instance)

Parameters

instance TInstance

The instance.

Exceptions

ArgumentNullException

Thrown if the instance is null.

Properties

OnDetachAction

Gets or sets the action to be fired when the listener is detached.

public Action<TInstance, WeakReferenceEventListener<TInstance, TSource>>? OnDetachAction { get; set; }

Property Value

Action<TInstance, WeakReferenceEventListener<TInstance, TSource>>

OnEventAction

Gets or sets the action to be fired when the event is triggered.

public Action<TInstance, TSource>? OnEventAction { get; set; }

Property Value

Action<TInstance, TSource>

Methods

Detach()

Called when detaching the event listener.

public void Detach()

Exceptions

Exception

Potentially thrown by the OnDetachAction delegate callback.

OnEvent(TSource)

Called when the event is fired.

public void OnEvent(TSource source)

Parameters

source TSource

The source of the event.

Exceptions

Exception

Potentially thrown by the OnEventAction delegate callback.