为什么将事件声明为委托? [英] Why events are declared as delegates?

查看:110
本文介绍了为什么将事件声明为委托?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在很多采访中都被问过这个问题,但还没找到答案。如果您有任何想法,请告诉我您的意见。

谢谢

Hi,
I have been asked this question in many interviews but could not find the answer yet. Please let me know your views if you have any idea.
Thanks

推荐答案

请看看这篇文章:



代表和活动 [ ^ ]



在我看来,文章中的引用总结了这一点:

委托对象封装了一个方法,以便可以匿名调用它。
Please have a look at this article:

Delegates and Events[^]

In my opinion this quote from the article sums it up:
A delegate object encapsulates a method so that it can be called anonymously.


这篇关于为什么将事件声明为委托?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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