Posted on: 1/2/2015 7:29:52 PM | Views : 539

I trying to find out why the delegate variable  "Changed" is null in the code below.
// setup a delegate for the event to fire with. public delegate void ChangedEventHandler(object sender, EventArgs e); public class MyEvent { // the event for class using delegate public event ChangedEventHandler Changed; protected void Button2_Click(object sender, EventArgs e) //3 { // make sure that there is something to call for the event to fire. if (Changed != null) //THIS Is null. **** Why? { //Invoke the event } } But if I change the linepublic event ChangedEventHandler Changed;to public event ChangedEventHandler Changed=delegate { }; it is working
 

Go to the complete details ...