Help understanding .NET delegates, events, and eventhandlers
- by Seth Spearman
Hello,
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?
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.
Thanks for your help.
Seth