Is there an example implementation of weak events using .NET\'s WeakEventManager?
I\'m trying to implement it by following the \"Notes to Inheritors\" in the documentati
Sharp Observation is an open source project that has an easy to use implementation. You might want to take a look at their code or just use it as-is.
Usage
The MakeWeak() method returns a new delegate which invokes the same target as the original delegate, but holds a weak reference to the target so that the listener is not kept alive by the delegate:
var handler= new PropertyChangingEventHandler(listener.HandleChange);
observable.PropertyChanging += handler.MakeWeak();
Limitations
The current implementation has the following restrictions on delegates: