Home > DeveloperSection > Interviews > What is a Delegate?

Posted on    October-15-2010 12:00 AM

 .NET .NET 
Ratings:
 2 Answer(s)
  1003  View(s)
Rate this:

Pushpendra Singh

Total Post:241

Points:1205
Posted on    October-30-2010 12:00 AM

A delegate is a form of type-safe function pointer used by the .NET Framework. Delegates specify a method to call and optionally an object to call the method on. They are used, among other things, to implement callbacks and event listeners. It encapsulates a reference of a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.


Amit Singh

Total Post:565

Points:2825
Posted on    November-09-2010 1:00 AM

Delegates are similar to object references, but are used to reference methods instead of objects. The type of a delegate is type or signature of the method rather than class. Hence a delegate has three properties:
  The type or signature of the method that the delegate can point to
  The delegate reference which can we used to reference a method
  The actual method referenced by the delegate

Don't want to miss updates? Please click the below button!

Follow MindStick