Hi
What's a delegate?
Delegate in C#
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jul 27, 2012, 2:10 AM EDT
The signature of the method must be compatible with that of the delegate itself.
The method can then be invoked via the delegate rather than directly which has certain advantages in some circumstances.
In C# all delegates derive from the System.MulticastDelegate class (a sub-class of System.Delegate) which means that the delegate can represent not one but several compatible methods all of which can be invoked one after the other by invoking the delegate itself.
Delegates are also the foundation of events and anonymous methods and lambda expressions can automatically be converted to compatible delegate types.