问题描述
我见过许多开发人员使用委托调用而不是Method调用。
有没有人请让我知道,为什么代表主要使用的是代理方法而且委托代表提高性能?
Amal Raj U
I have seen lot of developers using delegate calls rather than Method calls.
Does anyone please let me know, why delegates are mostly used than methods and does delegates increases performance ?
Amal Raj U
推荐答案
委托只是一个"数据类型"。一种方法;一种适合特定原型的方法的定义,即你可以定义一个委托来引用"一个带有1个字符串参数并返回一个整数的方法"。
A delegate is simply a "datatype" for a method; a kind of definition for a method that fits a particular prototype, i.e. you could define a delegate to refer to "a method that takes 1 string argument and returns an integer".
这允许您将方法作为参数传递并用作事件处理程序的回调等(如上所述
在这里。
This allows you to pass methods as arguments and use as callbacks for event handlers and so on (as describedhere).
这篇关于使用Delegate调用是否比使用Method类提高了性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!