Chapter 10. Delegates and Events
A delegate is an abstraction of one or more function pointers. With a delegate, you can treat a function as data, which includes using a delegate as a variable or data member. Delegates allow functions to be passed as parameters, returned from a function as a value, and even stored in an array. Unlike function pointers in other languages, particularly C and C++, delegates are type-safe, object-oriented, and secure, which reduces common problems associated with using function pointers.
Delegates are derived from the System.MulticastDelegate class, which itself is derived from System.Delegate. System.MulticastDelegate is a reference type and is an interface for managing and executing delegates. An instance of a delegate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access