Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Order of event handler execution

If I set up multiple event handlers, like so:

_webservice.RetrieveDataCompleted += ProcessData1; _webservice.RetrieveDataCompleted += ProcessData2; 

what order are the handlers run when the event RetrieveDataCompleted is fired? Are they run in the same thread and sequentially in the order that are registered?

like image 457
Phillip Ngan Avatar asked Oct 29 '09 17:10

Phillip Ngan


People also ask

In what order are event handler functions executed?

1) Currently they are executed in the order that the implementation of the specific event dictates - since you can implement your own add/remove methods for events. 2) When using the default event implementation via multi-cast delegates, the order is in fact required by specifications.

Which event listener fires first?

Event capturing the event handler of element1 fires first, the event handler of element2 fires last.

What are events How are event handlers implemented?

An event handler, in C#, is a method that contains the code that gets executed in response to a specific event that occurs in an application. Event handlers are used in graphical user interface (GUI) applications to handle events such as button clicks and menu selections, raised by controls in the user interface.

What can trigger execution of the event handler?

Event handler code can be made to run when an event is triggered by assigning it to the target element's corresponding onevent property, or by registering the handler as a listener for the element using the addEventListener() method.


1 Answers

Currently, they are executed in the order they are registered. However, this is an implementation detail, and I would not rely on this behavior staying the same in future versions, since it is not required by specifications.

like image 178
Reed Copsey Avatar answered Sep 20 '22 04:09

Reed Copsey