public void metN(object sender, MyCustomEventArgs e) { if (e.Cancel) { return; } // Do whatever you like if (< someBooleanStatement >) { e.Cancel = true; return; } // Do whatever you like }
//This is the method signature that you need to use to handle the event static void myClass_MyEvent(object sender, MyCustomEventArgs e) { Console.WriteLine(e.Foo); // prints "Bar" //Do Stuff }
//This event handler method is NOT Anonymous, since it has a name! void objP_NameChanged(object sender, MyCustomEventArgs e) { MessageBox.Show(e.EventMessage); }