Hi,
where are delegates used? in what scenarios?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jaganathan BantheswaranPosted Mar 4, 2011, 1:29 AM
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
Suthish NairPosted Mar 7, 2011, 2:17 PM
Amit ChoudharyPosted Mar 4, 2011, 1:28 AM
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