This question may lead to speculative answers but I presume there's a well thought design decision behind the implementation of event
in c#.
The event pattern in c# keeps the subscriber alive as long as the publisher of the event is alive. Thus, if you don't unsubscribe, you're leaking memory (well, not really leaking - but memory remains occupied unnecessarily).
If I want to prevent this, I can unsubscribe from events or implement a weak event pattern as proposed at MSDN.
With the event pattern causing so many problems (for beginners?), the question is: why was the decision made that the publisher keeps a strong reference to the subscriber, instead of making them independent or allowing developers to explicitly have a strong
or weak
modifier?
There are already a couple of questions here about this topic and the answers sound reasonable, but none really answers why it is like it is.