Lecture overview -- Keyboard shortcut: 'u'  Previous page: Delegates [Section] -- Keyboard shortcut: 'p'  Next page: Delegates that contain instance methods -- Keyboard shortcut: 'n'  Lecture notes - all slides together  Annotated slide -- Keyboard shortcut: 't'  Textbook -- Keyboard shortcut: 'v'  Alphabetic index  Help page about these notes  Course home    Operators, Delegates, and Events - slide 7 : 20

Delegates in C#

A delegate is a type the values of which consist of methods

Delegates allow us to work with variables and parameters that contain methods

Application.cs
A Delegate of simple numeric functions.
output
Output from the NumericFunction delegate program.
Application.cs
The static method Compose in class Application.
output
Output from the Compose delegate program.

Delegates make it possible to approach the functional programming style

Methods can be passed as parameters to, and returned as results from other methods

Go to exercise
Finding and sorting elements in an array
Go to exercise
How local are local variables and formal parameters?