一次运行更快的方法 [英] Faster method run at a time

查看:65
本文介绍了一次运行更快的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了委托者之外,是否还有其他更快的方法可以一次调用多个函数?

Is there any faster method other than Delegates to call more than one function at a time?

推荐答案

委托非常快,因此您不太可能''需要更快的东西.当您说一次调用多个函数时,是否意味着要在一个委托上将多个方法链接在一起以依次调用?我以为是这样,除非您引用异步编程模型进行多线程访问.

一种替代方法是在接口上定义一个方法,让所有订户"实现该方法,然后仅对调用该方法的集合进行迭代,但是坦率地说,我不知道这样做是否会更快.我*认为*这就是Java的方式.
Delegates are pretty quick, so it''s unlikely you''d need something faster. When you say calling more than one function at a time, do you mean chaining multiple methods together on a delegate to call sequentially? I presume so, unless you referring to the asynchronous programming model for multithreaded access.

An alternative is to define a method on an interface, get all ''subscribers'' to implement this and then just iterate over a collection calling the method, but frankly I have no idea whether that would be quicker. I *think* that''s the way Java does it.


这篇关于一次运行更快的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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