WHAT IS THE SYNTAX?
COULD YOU PLEASE GIVE ME AN EXAMPLE?
DELEGATS,HOW WE USE IN C# PROGRAMMING?
2 Answers
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 Feb 19, 2013, 4:49 AM EST
The output is:
Upamanyu Roy Choudhury146 reputationPosted Feb 20, 2013, 8:44 AM EST
We all know what is a function pointer in C++.
Delegate is the same thing in C#, it encasupates or holds a method.
It is suitable for anonymous method invocation i.e. it will be called as per situaion in the runtime and it forms the basis of event handling modeel.
The event handler like say a button click is nothing but a delegate , when a click event of the button occurs the delegate is called.
Below mentioned all the links shows delegate example in depth
http://www.codeproject.com/Articles/71154/C-Delegates-101-A-Practical-Example
http://msdn.microsoft.com/en-us/library/aa288459(v=vs.71).aspx
http://geekswithblogs.net/joycsharp/archive/2008/02/15/simple-c-delegate-sample.aspx
If there is any further query then keep me posted
Please mark it as an answer if you find this post as useful