First-class and higher-order functions

Functions are the fundamental processing units in functional programming, and since they can be used like any other value, functions can be stored in variables, properties, objects, and collections. The term first-class function was created by Christopher Strachey.

Note

Higher-order functions are functions that can either take other functions as arguments or return them as results.

C# supports higher-order functions (both named and anonymous), which are treated like ordinary variables with a function type.

Function type

C# provides the capability to define both generic functions and strongly typed delegates. The delegate type carries the method signature of a function prototype, and its instances become function ...

Get .NET Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.