事件处理程序的执行顺序 [英] Order of event handler execution

查看:240
本文介绍了事件处理程序的执行顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我设置了多个事件处理程序,就像这样:

If I set up multiple event handlers, like so:

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

什么顺序处理程序运行的时候事件 RetrieveDataCompleted 被激发?他们是否在已注册的顺序相同的线程和顺序执行?

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?

推荐答案

目前,他们所注册的顺序执行。然而,这是一个实现细节,而我也不会依赖此行为留在未来的版本是相同的,因为它不是由规范要求。

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.

这篇关于事件处理程序的执行顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆