B
Bruce Wood
I need to remove all handlers from a particular event. I am doing this
in the class where the event is defined.
I have this vague memory that I can say:
this.MyEvent = null;
and this will clear all delegates from the event, but I'm not sure, and
I can't find the relevant documentation.
Can I do that, or do I have to loop through each delegate like this:
foreach (Delegate d in this.MyEvent.GetInvocationList())
{
this.MyEvent -= d;
}
?
in the class where the event is defined.
I have this vague memory that I can say:
this.MyEvent = null;
and this will clear all delegates from the event, but I'm not sure, and
I can't find the relevant documentation.
Can I do that, or do I have to loop through each delegate like this:
foreach (Delegate d in this.MyEvent.GetInvocationList())
{
this.MyEvent -= d;
}
?