// Obtain the information of all events defined by the textbox class. propertyinfo Pi = (typeof (textbox )). getproperty ("Events", bindingflags. instance | bindingflags. nonpublic); // obtain the event handler list of textbox1 of the textbox object eventhandlerlist EHL = (eventhandlerlist) Pi. getvalue (this. textbox1, null); // obtain the field information of the control class textchanged event fieldinfo = (typeof (Control )). getfield ("eventtext", bindingflags. static | bindingflags. nonpublic); // use the field information of the obtained click event to match the event handler list of the textbox1 object and obtain the delegate object of the textbox1 object textchanged event. // The event is defined by the delegate, in C #, a multicast delegate can be bound to multiple Event Handlers. when an event occurs, these event handlers are executed in sequence // Therefore, the delegate object has a getinvocationlist method, used to obtain all event handlers bound to this delegate. Delegate d = EHL [fieldinfo. getvalue (null)];
Get events bound to the control