Saturday, December 29, 2012

What are the 5 uses of delegate

1. Most important use of delegates- it helps us to define an abstract pointer which can point to methods and functions. The same abstract delegate can be later used to point to that type of functions and methods.

2. Callback mechanism Many times we would like to provide a call back mechanism. Delegates can be passed to the destination and destination can use the same delegate pointer to make callbacks.

3. Asynchronous processing By using ‘BeginInvoke’ and ‘EndInvoke’ we can call delegates asynchronously.

4. Multicasting - Sequential processing Some time we would like to call some methods in a sequential manner which can be done by using multicast delegate.

5. Events - Publisher subscriber modelWe can use events to create a pure publisher / subscriber model.


Code Project uses of delegate click here

No comments:

Post a Comment