帮助理解.NET委托,事件和事件处理器 [英] Help understanding .NET delegates, events, and eventhandlers

查看:110
本文介绍了帮助理解.NET委托,事件和事件处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在过去几天我问了一个有关委托的这里和的这里
我承认......我真的不明白的代表。我真的真的真的想了解和掌握它们。 (我可以定义他们 - 类型安全的函数指针 - 但因为我有C型语言经验少它是不是真的有用)

In the last couple of days I asked a couple of questions about delegates HERE and HERE. I confess...I don't really understand delegates. And I REALLY REALLY REALLY want to understand and master them. (I can define them--type safe function pointers--but since I have little experience with C type languages it is not really helpful.)

谁能推荐一些在线资源(S),将在假定没有办法解释的代表?

Can anyone recommend some online resource(s) that will explain delegates in a way that presumes nothing?

这是那些我怀疑,实际上VB我妨害因为它确实有些接线我在幕后的时刻之一。

This is one of those moments where I suspect that VB actually handicaps me because it does some wiring for me behind the scenes.

理想的资源也只是解释的代表是什么,没有提及任何其他像(事件和事件处理器),会告诉我所有的一切是如何连接起来,说明(如我只学会)的代表是类型和独特之处作为一个类型(可能使用一个小魔术ILDASM))。然后,该基金会将扩大解释的代表是如何与这将需要有自己的权利相当不错的解释,事件和事件处理器。最后这个资源可以配合这一切一起用实际例子和解释的布线DOES由编译器自动发生,如何使用它们,等。并且,哦,是的,当你应该和不应该使用委托,换句话说,缺点和替代品使用代表。

The ideal resource would just explain what delegates are, without reference to anything else like (events and eventhandlers), would show me how all everything is wired up, explain (as I just learned) that delegates are types and what makes them unique as a type (perhaps using a little ildasm magic)). That foundation would then expand to explain how delegates are related to events and eventhandlers which would need a pretty good explanation in there own right. Finally this resource could tie it all together using real examples and explain what wiring DOES happen automatically by the compiler, how to use them, etc. And, oh yeah, when you should and should not use delegates, in other words, downsides and alternatives to using delegates.

你们说什么?可以任你点我的资源(S),可以帮助我开始我的旅程,融会贯通?

What say ye? Can any of you point me to resource(s) that can help me begin my journey to mastery?

修改
最后一件事。理想的资源将解释如何能和不能在接口声明中使用委托。这是东西,真的绊倒了我。

EDIT One last thing. The ideal resource will explain how you can and cannot use delegates in an interface declaration. That is something that really tripped me up.

感谢您的帮助。

赛斯

推荐答案

我将开始与这些:

http://www.yoda.arachsys.com/csharp/events.html

http://msdn.microsoft.com/en-us /library/ms173171.aspx

这篇关于帮助理解.NET委托,事件和事件处理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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