An in-depth exploration of delegates, events, and lambdas: C# elements for creating more efficient and flexible functions.
- [Voiceover] Hi, I'm Joe Marini and this is C# Delegates, Events and Lambdas. The C# programming language has the rich expressive ability of declaring functions to fit a variety of different scenarios and we'll see how to use three of them in this course. We'll start by learning about Delegate functions, which in addition to being useful all by themselves, also form the foundation for Events and Lambda functions. Delegates provide a mechanism for declaring functions to be called in your program in a way that lets them be swapped while the program is running.
This allows for greater separation of different functional areas of your program which makes it easier to maintain and extend your application. Next, we'll see how to use C# Events to both broadcast and listen to messages within an application as well as from outside the application. Events give your application a way to communicate asynchronously with other parts of your program and other programs and they can be switched on and off as you need them. Finally, we'll look at Lambda functions. Lambdas provide a concise way of declaring inline functions that are usually one off in nature or perform a small focused operation that can be neatly implemented right where it is used in a program.
This makes your code more compact and easier to read. These three function types give you a flexible set of programming tools to help make your C# code easier to read and maintain, while addressing distinct scenarios that appear in almost every program. Let's get started learning about C# Delegates, Events, and Lambdas.
Start watching to learn how to adapt this flexible set of programming tools to your own C# programming needs.