Share via


WeakEventManager Class

Definition

Manages weak event subscriptions, preventing memory leaks by maintaining weak references to handlers.

public ref class WeakEventManager
public class WeakEventManager
type WeakEventManager = class
Public Class WeakEventManager
Inheritance
WeakEventManager

Constructors

WeakEventManager()

Methods

AddEventHandler(Delegate, String)

Adds an event handler for the specified event, storing a weak reference to the handler's target.

AddEventHandler<TEventArgs>(EventHandler<TEventArgs>, String)

Adds an event handler for the specified event, storing a weak reference to the handler's target.

HandleEvent(Object, Object, String)

Invokes the handlers registered for the specified event. Removes handlers whose targets have been garbage collected.

RemoveEventHandler(Delegate, String)

Removes a previously added event handler for the specified event.

RemoveEventHandler<TEventArgs>(EventHandler<TEventArgs>, String)

Removes a previously added event handler for the specified event.

Applies to