Definition - What does Delegate mean?

A delegate is an object-oriented, managed, secure and type-safe function pointer in the .NET framework. A delegate signature includes its name, return type and arguments passed to it. Rather than passing data, a delegate passes a method to another method. Delegates are used in many contexts, including implementing callbacks and event handlers, entry thread points and multiple types of method specifications. Because a delegate does not know the class of a referenced object, it is used for anonymous invocation.

Techopedia explains Delegate

A delegate's main purpose is linking the delegate object to the caller, which means that the called method reference does not require specification at compile time. Delegates play a vital role in the event driven programming model, where event handlers are added to user interface (UI) controls.

Delegate types are:
  • Single-cast: Points to a single method
  • Multicast: Refers to multiple methods, each with the same signature and only includes methods returning void to avoid exception during runtime
Other delegate features are as follows:
  • They execute under caller, versus declarer, permissions.
  • Delegate objects are immutable.
  • Its default access modifier is private (internal) or public.
  • A delegate may be used after instantiation only.
  • Delegates may be declared as nested types with accessibility modifiers for their containing class or struct. In the event of failure during delegate method execution, the thrown exception is passed back to the delegate's caller, and further invocations are stopped.

Share this:

Connect with us

Email Newsletter

Join thousands of others with our weekly newsletter

The 4th Era of IT Infrastructure: Superconverged Systems
The 4th Era of IT Infrastructure: Superconverged Systems:
Learn the benefits and limitations of the 3 generations of IT infrastructure – siloed, converged and hyperconverged – and discover how the 4th...
Approaches and Benefits of Network Virtualization
Approaches and Benefits of Network Virtualization:
Businesses today aspire to achieve a software-defined datacenter (SDDC) to enhance business agility and reduce operational complexity. However, the...
Free E-Book: Public Cloud Guide
Free E-Book: Public Cloud Guide:
This white paper is for leaders of Operations, Engineering, or Infrastructure teams who are creating or executing an IT roadmap.
Free Tool: Virtual Health Monitor
Free Tool: Virtual Health Monitor:
Virtual Health Monitor is a free virtualization monitoring and reporting tool for VMware, Hyper-V, RHEV, and XenServer environments.
Free 30 Day Trial – Turbonomic
Free 30 Day Trial – Turbonomic:
Turbonomic delivers an autonomic platform where virtual and cloud environments self-manage in real-time to assure application performance.