|
|
Delegates in C# | Delegates are types. The objects in such types are methods. With the introduction of delegates,
methods become data. |
A delegate is a type the values of which consist of methods Delegates allow us to work with variables and parameters that contain methods |
An example which defines a simple delegate (a type of methods) called NumericFunction.
The example illustrates both existing, named methods in NumericFunction and
a new, anonymous method in in the type. |
Illustrates a method that takes two NumericFunction objects as input, and which returns
a NumericFunction. |
Delegates make it possible to approach the functional programming style Methods can be passed as parameters and returned as results to and from other methods |
|
Read more about delegates in the text book version of this material. |