liveBook · Manning

Delegate

A delegate is a type-safe callable reference to one or more methods whose signatures match a specified delegate type.

How 2 Manning books explain it

Functional Programming in C#, Second Edition

A C# delegate instance is a type-safe reference to one or more compatible methods.

How it is used
Represents operations as strongly typed values for functional-style programming, including custom comparisons passed to sorting.
How deep it goes
Defines compile-time type safety and the two-step declaration-and-implementation process, without exploring delegate internals.
Examples
Uses Comparison<T> to sort integers by their string representations.
What you can do after
Apply delegates by supplying a typed comparison implementation to sort a list.

Read how Functional Programming in C#, Second Edition explains delegate →

Fabulous Adventures in Data Structures and Algorithms

A delegate type is a C# type that represents a callable method signature and can hold a type-safe reference to a compatible method or function.

How it is used
Uses delegates to represent deferred concatenation inside an immutable Hughes list.
How deep it goes
Explains named delegate types, lambda construction, invocation, deferred work, complexity, and stack-depth consequences.
Examples
Demonstrates curried addition, a Concat delegate, Hughes-list construction, materialization, popping, and enumeration.
What you can do after
Build it from scratch as a deferred, type-safe function representation for efficient immutable-list accumulation.

Read how Fabulous Adventures in Data Structures and Algorithms explains delegate →

Also covered in

Related concepts

Questions about delegate

What is delegate?

A delegate is a type-safe callable reference to one or more methods whose signatures match a specified delegate type.

Which Manning books explain delegate?

Functional Programming in C#, Second Edition and Fabulous Adventures in Data Structures and Algorithms.

What kinds of delegate are there?

Kinds of delegate include Comparison<T>, EndpointFilterDelegate and Func<T>.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.