← C# Programming learning path
C# Programming · Module 9 of 10

Delegates, events and lambdas

Pass behaviour around and react to events.

📖 Key ideas

  1. A delegate is a type-safe function reference.
  2. Func<T, TResult> and Action<T> are built-in delegates.
  3. Lambdas: x => x * 2.
  4. Events let objects notify subscribers: button.Click += Handler.
  5. Used in UI apps, LINQ and callbacks.
💡 Real-life example: An event is a doorbell; subscribers are people who come running when it rings.
DelegateReference to a method
FuncDelegate returning a value
ActionDelegate returning void
EventNotification mechanism