I don’t know how can I break event handler method list.
For example I have follow code. What should i write in IF statement?
public event EventHandler myEvent;
...
myEvent += new EventHandler(met1);
myEvent += new EventHandler(met2);
myEvent += new EventHandler(met3);
...
public void met2(object sender, EventArgs e)
{
...
if(myCondition)
{
//there I want to break execution of all methods assiciated with myEvent event
//I want to break met2 and don't allow to execute met3
}
...
}
You can define your delegate, so your
custom event handler, whith its customEventArgs, with boolean value.Example:
In this way, if we in any other event handlder before processing it, check if
Handled == true, one time it’s set into that state from one of them, others would skip that event processing.Just an idea example, you have to change it to fit your code exact needs.