How to determine if an event is already subscribed
Posted
by Ram
on Stack Overflow
See other posts from Stack Overflow
or by Ram
Published on 2010-04-23T08:45:52Z
Indexed on
2010/04/23
8:53 UTC
Read the original article
Hit count: 312
Hi,
In my .NET application I am subscribing to events from another class. The subscription is conditional. I am subscribing to events when the control is visible and de-subscribing it when it become invisible. However in some conditions I do not want to de-subscribe the event even if the control is not visible as I want the result of an operation which is happening on background thread .
Is there any way through which I can determine if a that class has already subscribed to that event.
I know we can do it in the class which will raise that event by checking event with null but I don not know how to do it in a class which will subscribe to that event.
© Stack Overflow or respective owner