Introduction

In this section, you'll get a subtle introduction on delegates and you'll know why they're used.

We'll cover the following

A delegate object encapsulates any reference method or methods that can then be called upon just by calling the delegate object. This way, the users won’t know explicitly which methods are being invoked at compile time.

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 are good, as you can notify several methods that an event has occurred if you wish so.

Get hands-on with 1200+ tech skills courses.