First class functions and higher order functions in c#
The concept of first class functions and higher order functions is really important to use the modern programming languages effectively and we should take maximum benefit from the functional programming support in c#. Though its not a truly functional programming language but still you can do lot of functional programming in c#.
First-Class Functions: The ability of a programming language in which functions can be assigned to a variable and can be treated just like other variables is called first class functions support. Immediately few questions should come to your mind like Is this something new? Does c++ support first class functions? The answer is that this is not something new and c++ support first class functions as well in the form of function pointers. C# also support first class functions and one way to do is that through delegates.
Higher Order Functions: The functions that take function as an argument or return functions as return value are called higher order functions. So the languages that support first class functions generally support higher order functions. c++ and c# both support higher order functions through various mechanisms which I am going to discuss in detail in future posts .