Paid Internships Jobs
One Search. All Jobs. Indeed™.
When you do not know what is going to happen until run time. Since delegates are of user type, and you do not know what is going to happen at run time the best practice is to return void values. This is what makes them ideal for event handling, if you need more then 1 event handled in the same action, they can be added to the delegate and fired in what ever selectable order.
Also delegates can make calls to methods from other classes you do not wish to interface all the methods of. So you can select what methods are accessible.
Delegates can be used in following cases:-
1) When you want to pass the methods as a parameter
2) most important usage of delegate is event handling.
Event Handlers are nothing but methods being pointed by delegates and called.
3) It can also be used in Callbacks
4) Asynchronous processing
if i am not wrong then if you have a multiple process to do in parallel then use delegate
Delegates are useful when you do want to propagate events to other objects without any relationship with them.