I understand the benefits of events using delegate types with signature delegate void delegate_name(object sender, EventArgs e)
a) But besides the fact that it may save us some typing, are there any other reasons why we should use already defined delegate types EventHandler/EventHandler<T>
instead of declaring our own delegate types with signature delegate void delegate_name(object sender, EventArgs e)
?
b) Two other reason I can think of for using the predefined delegate types EventArgs/EventArgs<T>
are:
people consuming particular event ( say
event EventHandler my_event
) will immediately know how to use that event?perhaps some popular third party methods accept as parameters
EventHandler/ EventHandler<T>
delegate types, and thus if there’s any chance that our code may use those third party methods, we should use predefined delegatesEventHandler/Eventhandler<T>
?
thank you