Delegate

Definition & Meaning

Last updated 23 month ago

What is Delegate?

A delegate is an item-orientated, conTrolled, steady and kind-secure feature pointer inside the .NET Framework. A delegate signature includes its call, go back type and arguments exceeded to it. Rather than passing Records, a delegate passes a way to every other approach. Delegates are used in lots of Contexts, consisting of enforcing callbacks and occasion handlers, Access Thread points and more than one varieties of technique specifications. Because a delegate does not recognise the Class of a referenced item, it's far used for Anonymous invocation.

What Does Delegate Mean?

A delegate’s important motive is linking the delegate item to the caller, which means that the called technique reference does no longer require specification at Compile time. Delegates play a essential Function in the Event driven Programming version, where occasion handlers are brought to consumer Interface (UI) controls.

Delegate types are:

  • Single-solid: Points to a unmarried Method
  • Multicast: Refers to multiple techniques, each with the identical signature and only consists of techniques returning void to keep away from Exception for the duration of runtime

Other delegate functions are as follows:

  • They execute beneath caller, as opposed to declarer, permissions.
  • Delegate Objects are immuTable.
  • Its default get right of entry to modifier is Private (inner) or Public.
  • A delegate may be used after instantiation simplest.
  • Delegates can be declared as Nested Types with Accessibility modifiers for their containing class or struct. In the occasion of Failure throughout delegate technique execution, the thrown exception is surpassed again to the delegate’s caller, and in addition invocations are stopped.

Share Delegate article on social networks

Your Score to Delegate article

Score: 5 out of 5 (1 voters)

Be the first to comment on the Delegate

2756- V4

tech-term.com© 2023 All rights reserved