4 Replies - 1316 Views - Last Post: 25 May 2011 - 05:17 AM
Posted 24 May 2011 - 06:17 AM
Replies To: Delegates
Posted 24 May 2011 - 06:28 AM
This way you can store these references and later on call all of them with out needing to know where they are from. This is helpful for things like events or the sort.
Events are obvious scenarios, (and 'event' is actually just a dressed up delegate), but there are other good examples.
For instance say you have a an interpolation animation going on. You have a generic interpolation method 'shape' that the animation is expecting. You can then define multiple functions that define multiple algorithms for interpolating across the animation. Then down the line you can just pass along which method to use.
This post has been edited by lordofduct: 24 May 2011 - 06:33 AM
Posted 24 May 2011 - 06:36 AM
Delegates from the beginning, tutorial
Delegates, lambdas and expressions tutorial
Generics primer tutoral (with section on delegates)
Intro to tasks tutorial (which requires delegates)
Not to mention a search for "delegates" within the C# forum gets you a lot of times this has been asked and answered.
And if you look at the bottom if this page you will see several links that are related.
I think the term you are grasping for is the method's "signature". The combination of parameters and return type. That's probably how it is referred to in the OP's textbook.
This post has been edited by tlhIn`toq: 24 May 2011 - 06:33 AM