Chapter 2. Walkthrough Delegates

In the previous chapter, we applied delegates in the code we created. When we discussed the concept of functional programming, we applied one of the built-in delegates that C# has. In this chapter, we are going to delve into the delegates that will be used a lot in functional C# programming by discussing the following topics:

  • The definition, syntax, and use of delegates
  • Combining delegates into multicast delegates
  • Using built-in delegates
  • Understanding the variance in delegates

Introducing delegates

A delegate is a data type in C# that encapsulates a method that has particular parameters and return types (signatures). In other words, a delegate will define the parameters and the return type of a method. Delegates are ...

Get Functional C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.