G
Guest
I have a button click event, and would like to know the handlers listening to
this click event, so that no handler will be bound twice.
Any way?
this click event, so that no handler will be bound twice.
Any way?
Dan Kelley said:Yes, this is possible (to some extent).
Could you define your event as follows:
private EventHandler myEventHandler;
public event EventHandler MyEvent
{
add
{
Delegate[] subscribedDelegates = MyEvent.GetInvocationList();
//can now recurse over subscribers
this.myEventHandler += value;
}
remove
{
this.myEventHandler -= value;
}
}
Please note I am not saying this is a good idea. I am just saying this is a
possible way it can be done.
HTH
Dan
zhaounknown said:I have a button click event, and would like to know the handlers listening to
this click event, so that no handler will be bound twice.
Any way?