C# How to unsubscribe all event handlers from a given event?

Posted by Adi Barda on Stack Overflow See other posts from Stack Overflow or by Adi Barda
Published on 2010-03-28T13:19:18Z Indexed on 2010/03/28 13:23 UTC
Read the original article Hit count: 1709

Filed under:
|
|

Hi Guys,
Is there a simple way to iterate all over the handlers subscribed to a given event? my problem is that clients subscribe but forget to unsubscribe so a memory leak happens. I need a way for an object to disconnect all the handlers of its events in the Dispose method so a leak would not happen - at least not because of events.

Hope my question was clear

thank you,
Adi Barda

© Stack Overflow or respective owner

Related posts about c#

Related posts about events