Why Delegate came in the .net oops World ?[Not only delegates including u and me ]
Normally Functions We called in OOPS by object of the class .So each time Function stack Will create when we execute the function . So memory will be wasting here. To Resolve this problem ,delegate came actually .
Delegate is a function pointer ,it creates function stack and execute the function on a same memory location ((number of times you called also) .So no seperate memory allocation is Required to each and every time to call a function .
What is the use of Delegate in oops World ?[Not only delegates including u and me]
Delegate can take function as an Argument .
For handling events delegate is used
Calling a method in C# asynchronously using delegates.
That is, through a delegate, you can begin invocation of a method and then return
immediately while the delegate executes its method in a separate thread. Your page execution does not need
to wait for that method to complete.
http://www.codeproject.com/Articles/426120/Calling-a-method-in-Csharp-asynchronously-using-de
Delegates and Events[lovers -because without delegates events are not fired. Love makes Life Beautiful at the same way Delegate and events makes application beautiful ] :
Dalegete is a function pointer which can able to store the address of any function with same prototype.
Event is a function handler which can handles or run the functions in same prototype of its delegate.
delelgate is reference to a method.
event is way to access that method using that delegate.
Comments
Post a Comment