How to return a value form Event in C#
public delegate bool MyEventHandler(object sender /* additional params */); public event MyEventHandler MyEvent; public void MyMethod() { if (MyEvent != null && MyEvent(this)) { /* TODO: do something */ } } public void MyBind() { MyEvent += new MyHandler(this); } private bool MyHandler(object sender) { return true; } |