Hi,
where are delegates used? in what scenarios?
Loading
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 attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Mar 3, 2011, 8:29 PM EST
Basically it is similar like the old "C" - function pointer, where functions can be assigned like a variable and called in the run time based on dynamic conditions. C# delegate is the smarter version of function pointer which helps software architects a lot, specially while utilizing design patterns.
At first, a delegate is defined with a specific signature (return type, parameter type and order etc). To invoke a delegate object, one or more methods are required with the EXACT same signature. A delegate object is first created similar like a class object created. The delegate object will basically hold a reference of a function. The function will then can be called via the delegate object.
Refer this article. http://www.c-sharpcorner.com/UploadFile/subhendude/4621/
refer this forum : http://www.c-sharpcorner.com/Forums/Thread/110712/why-use-delegates-only-to-access-methods-is-there-a-pur.aspx
http://www.c-sharpcorner.com/UploadFile/niradhip/delegates109122009063813AM/delegates1.aspx
Amit ChoudharyRank #145 · 15.8K reputationPosted Mar 3, 2011, 8:28 PM EST
2. Asynchrnous invoke of methods
3. Multithreading
4. Anonymous methods
Search out on these headings and you'll find more details how to use delegate to perform these actions.
Thanks
Suthish NairRank #92 · 22.8K reputationPosted Mar 7, 2011, 9:17 AM EST