.NET代理是否用于事件? [英] Are .NET delegates used for events?

查看:90
本文介绍了.NET代理是否用于事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很少困惑,我知道代表就像函数指针,它们被用来作为一个参数传递给一个方法。



适合事件模型?



调用:

  myButton。 OnClick + = new .....(); 

内部只是在事件发生时传递方法/函数作为参数,所有订阅者都是通知有关事件?

解决方案

看看这个



好奇心是幸福


I'm little confused, I know that delegates are like function pointers, and they are used to pass a function as a parameter into a method.

How does that fit into the event model?

Calling:

myButton.OnClick += new .....();

Is that internally just passing the method/function as a parameter when the event occurs and all the subscribers are notified about the event?

解决方案

Have a look at this

Curiosity is bliss

这篇关于.NET代理是否用于事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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