Some of the ways I heard describe delegates:
- Language and frame support for first-class features.
- Interfaces with one method.
- Pointers to type functions.
- Objects representing a sequence of operations with a well-defined contract.
If you try in more detail, I would:
- Distinguish between System.Delegate, delegate types, delegate type variables, and delegation instances; spell out your declaration, purpose, transfer, and challenge.
- Emphasize their invariable nature of the reference type.
- Discuss the multicast delegates.
- List some common types of delegates in the structure, especially the Func <> and Action <> families.
- Associates delegates with method groups, anonymous methods, lambda expressions, and closures. Explain the use of the
delegate keyword in C #, as well as various courtesies provided to the programmer by the compiler - Discuss their relationship to streams, events, expression trees, and LINQ.
- Discussion:
- Functions of a higher order - currying, combinators, etc.
- How delegates can be used with reflection.
- Deviation in relation to delegates.
source share