Search⌘ K
AI Features

What are Delegates?

Explore how delegates in C# work to reference and call methods when events occur. Understand delegate declarations, instances, method referencing, and the foundation they provide for event-driven programming.

We'll cover the following...

A delegate is a way of telling C# which method to call when an event is triggered.

For example, if you click a Button on a form, the program would call a specific method. It is this pointer that is a delegate.

Delegates form the basis of event handling in C#.

They are a construct for abstracting and creating objects that reference ...