EventInfoUtility.WeakSubscribe<TSource,TTarget> method (1 of 2)

Subscribes to the event of the specified source with a weak reference to the subscriber.

public static Scope WeakSubscribe<TSource, TTarget>(this EventInfo<TSource, EventHandler> info, 
    TSource source, TTarget target, Action<TTarget, object?, EventArgs> action)
    where TTarget : class
parameter description
TSource The type of the source.
TTarget The type of the target.
info The event info.
source The source.
target The target.
action The action, which generally delegates to the actual event handler on the target.

Return Value

A Scope that unsubscribes from the event when disposed.

See Also


EventInfoUtility.WeakSubscribe<TSource,TTarget,TEventArgs> method (2 of 2)

Subscribes to the event of the specified source with a weak reference to the subscriber.

public static Scope WeakSubscribe<TSource, TTarget, TEventArgs>(
    this EventInfo<TSource, EventHandler<TEventArgs>> info, TSource source, TTarget target, 
    Action<TTarget, object?, TEventArgs> action)
    where TTarget : class
    where TEventArgs : EventArgs
parameter description
TSource The type of the source.
TTarget The type of the target.
TEventArgs The type of the event args.
info The event info.
source The source.
target The target.
action The action, which generally delegates to the actual event handler on the target.

Return Value

A Scope that unsubscribes from the event when disposed.

See Also