什么是委托和事件之间的区别是什么? [英] What are the differences between delegates and events?

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

问题描述

什么是委托和事件之间的区别是什么?请勿将持有的引用可以执行的功能呢?

What are the differences between delegates and an events? Don't both hold references to functions that can be executed?

推荐答案

这是的活动的声明增加了抽象和保护的委托实例层。这种保护prevents从重置代理和调用列表委托的客户,只允许调用列表中添加或删除目标。

An Event declaration adds a layer of abstraction and protection on the delegate instance. This protection prevents clients of the delegate from resetting the delegate and its invocation list and only allows adding or removing targets from the invocation list.

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

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