Delegates

A C# delegate is a type-safe method reference. With delegates, a program can dynamically call different methods at runtime. The primary purpose of delegates is to establish an infrastructure to support events. Events are simply specialized delegates. They enable programs to create callback methods and register those methods with events in a publish/ subscribe notification pattern. This section shows how to create delegates.

Defining Delegates

A delegate defines the signature and return type of a method. It also creates a new type to which a method must conform before it may be assigned to a delegate. Once a method has been assigned to a delegate, it is called when the delegate is invoked. Here's how a delegate signature is defined shows ...

Get C# Unleashed 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.