Delegate

caracalla
caracalla used Ask the Experts™
on
Can someone point me to a clear and concise explanantion please of uses and using delegates please ? All the books I read suffer from verbal diarrhea. It's driving me crazy !!!!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2006
Commented:
you could try this

title : Event Handling in .NET Using C# - Delegates in C#
source : http://www.developerfusion.com/show/2137/2/

----------
A delegate in C# allows you to pass methods of one class to objects of other classes that can call those methods. You can pass method m in Class A, wrapped in a delegate, to class B and Class B will be able to call method m in class A. You can pass both static and instance methods. This concept is familiar to C++ developers who have used function pointers to pass functions as parameters to other methods in the same class or in another class. The concept of delegate was introduced in Visulal J++ and then carried over to C#. C# delegates are implemented in .Net framework as a class derived from System.Delegate. Use of delegate involves four steps.

1. Declare a delegate object with a signature that exactly matches the method signature that you are trying to encapsulate.
2. Define all the methods whose signatures match the signature of the delegate object that you have defined in step 1.
3. Create delegate object and plug in the methods that you want to encapsulate.
4. Call the encapsulated methods through the delegate object.

----------

be sure to check the sample code and try it out so you get a bit of a feel for it

hope this helps a bit
Top Expert 2006

Commented:
and i remember this one

title : Explain Delegates to me
source : http://www.experts-exchange.com/Q_20708299.html

Author

Commented:
thank you

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial