1

Possible Duplicates:
When would you use delegates in C#?
The purpose of delegates
Delegates, Why?
What are the advantages of delegates?

What are Delegates in c# and why are they used?

Thanks,

Pradeep

Community
  • 1
  • 1
Pradeep
  • 2,639
  • 11
  • 36
  • 45
  • 2
    There are so many similar questions. http://stackoverflow.com/questions/687626/the-purpose-of-delegates – Larsenal Sep 20 '10 at 16:09
  • Exact duplicate of about a dozen other questions... This one closed for the same reason: http://stackoverflow.com/questions/3567478/delegates-why-closed – Dan Puzey Sep 20 '10 at 16:10

3 Answers3

1

Delegates are essentially method pointers; they are used to call a method from a location unknown at compile-time. For example, they can be used by events (every time you add an eventhandler, what you're really doing is adding a delegate to your handler to a collection of handlers to be notified when the event is raised.

STW
  • 44,917
  • 17
  • 105
  • 161
0

They are method pointers.

Read more here.

mmutilva
  • 18,688
  • 22
  • 59
  • 82
0

A delegate is a kind of type that can refer to a method (instance or static). If you are familiar with function pointers in C++, they are conceptually similar.

Since they are a type, an instance of a delegate type can be created and assigned to a method at runtime, this allows you to implement things like callbacks and events.