Delegates are the gateway to functional programming. So let’s understand delegates and how we can change the way we program by using functions as parameters, return types, variables, and properties. In addition, we’ll see how the built in delegate types, Func and Action, are waiting to make our lives easier. By the time we’re done, we’ll see how delegates can add elegance, extensibility, and safety to our programming. And as a bonus, you’ll have a few functional programming concepts to take with you.
This repository contains slides and code samples for a live presentation. You can find articles and a video series on the topic below.
The code currently uses .NET 8.0.
Presentation Recordings:
- NDC London - Recorded Jan 2017
YouTube Series
- Video Playlist: C# Delegates
- Video: C# Delegates - Part 1: Basics
- Video: C# Delegates - Part 2: Get Func-y (+ Lambdas)
- Video: C# Delegates - Part 3: Action and Multicast Delegates
Articles:
- C# Delegates - PDF Walkthrough of the code samples.
Note: This is a bit old, but the code is all still valid. - Exceptions in Multicast Delegates
- More Delegate Exception Handling
- Recognizing Higher-Order Functions in C#
- Named Delegates Compared to Anonymous Delegates
Additional Topics
- Topic (videos and articles): Learn to Love Lambdas in C# (and LINQ, Too!)
- Video: Anatomy of a Lambda Expression
- Topic (videos and articles): Generics in C#
For additional information, please visit jeremybytes.com.