Example of Delegate?

Posted by Naga116 under C# on 7/23/2011 | Points: 10 | Views : 1282 | Status : [Member] | Replies : 2
I checked in delegate meaning. but i am unable to understand exact use of delegate
Can you please help in this

Nagaraju


Responses

Posted by: A4u_6178 on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,
refer the thread...
http://www.dotnetspider.com/forum/11830-why-use-delegate.aspx

Thanks & Regards,

Naga116, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/23/2011 [Member] Starter | Points: 25

Up
0
Down
A delegate object is a special type of object that contains the details of a method rather than data delegates in .net are used for two purposes
a) Callback
b) Event Handling
whereas A callback is a reference to executable code, or a piece of executable code, that is passed as an argument to other code. This allows a lower-level software layer to call a subroutine (or function) defined in a higher-level layer.

basically Delegates specify a method to call and optionally an object to call the method on. They are used, among other things, to implement callbacks and event listeners. It encapsulates a reference of a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked.

I will suggest you to have a go though some excellent articles which will might help you to learn Delegate in Details
Link1-[ http://msdn.microsoft.com/en-us/magazine/cc301810.aspx ]
and a series of articles for Delegates
Link--[ http://www.dotnetscraps.com/dotnetscraps/post/Explaining-Delegates-in-C.aspx ]

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Naga116, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response