Caffeinated Coder
Book an appointment
Lesson 15 · Working with data

Delegates and lambdas

A delegate is a type whose values are methods, and a lambda is a method written in place with no name. Follow seven lines of C#: the lambda x => x > limit becomes a delegate object on the heap, LINQ's Count calls it once per element and prints 2, and after limit changes the same delegate answers 3, because a lambda captures variables, not copies of their values.

14 min11 steps5 questionsIntermediate
Fig 15 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.