what is a delegate? what it is used for?

Answer Posted / subbu

Delegates are a type that references method. Normally when
we calling a method we will pass some data to that method
as input parameter. But in some scenario we might need to
pass method as input parameter to other method in such case
we can use delegate.
Delegate wraps any method which matches its signature,
calling a delegate result in calling a method so this gives
the ability to call the method programmatically based on
our business needs.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of constructor in c# with example?

509


Define c# i/o classes? List the commonly used classes?

633


Can we call server-side code (c# or vb.net code) from javascript?

605


What is ac callback?

580


What is a virtual property. Give an example?

608






What do you know about WM_CHAR message?

650


How do you pass reference parameters in c#?

527


What is yield return in c#?

567


How to Install uninstall assemblies into GAC?

579


Explain the difference between and xml documentation tag?

582


Can struct have constructor c#?

584


Explain the difference between abstract class and interface.

685


What is difference between c sharp and c#?

555


Is inheritance possible in c sharp?

714


What are the types of delegates in c#?

549