As per Microsoft doc:
The weak event pattern can be used whenever a listener needs to register for an event, but the listener does not explicitly know when to unregister.
A sample code here illustrates that when using WeakEventManager
, not explicitly calling RemoveHandler
will not cause memory leak.
So my question is, why is the method RemoveHandler
even there in WeakEventManager
class? Isn't it completely unnecessary? When it becomes necessary?