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

问题描述

在过去的几天里,我询问了有关代表的几个问题: HERE 和。
我承认...我真的不了解代表。我真的很想真的要理解和掌握他们。 (我可以定义它们 - 键入安全的函数指针 - 但是由于我没有C语言的经验,这不是很有帮助。)



任何人都可以推荐一些在线将以不推定任何方式解释代表的资源?



这是我怀疑VB实际上妨碍我的那些时刻之一,因为它在幕后为我做了一些布线。



理想的资源只是解释什么代表,没有引用任何其他事情(事件和事件处理程序)会告诉我所有的一切都连接起来,解释(作为我刚刚学到)代表是类型,什么使它们作为一个类型(可能使用一点点ildasm魔术)是唯一的)。那么这个基础将会扩大,以解释代表如何与事件和事件处理者有关,这将需要一个很好的解释在自己的权利。最后,这个资源可以使用真实的例子将它们结合在一起,并解释编译器自动发生的接线以及如何使用它们等等。而且,哦,是的,当你不应该和不应该使用代表,换句话说,缺点和替代方案使用代表。



你们说什么?你们中有人可以指出我可以帮助我开始我的掌握之旅吗?



编辑
最后一件事。理想的资源将解释如何在接口声明中使用和不能使用代理。感谢您的帮助。



Seth

解决方案

我将从这些开始:






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.)

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

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

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.

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

EDITOne 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.

Thanks for your help.

Seth

解决方案

I would start with these:

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

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

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

09-03 13:30