what is a delegate? what it is used for?
Answers were Sorted based on User's Feedback
Answer / bijeshs
Delegates are reference types which allow indirect calls to
methods .some single delegates can reference multiple
methods
| Is This Answer Correct ? | 24 Yes | 5 No |
Answer / ranjith
Delegate is nothing but a Function pointer,which stores the
address of a method.
These of two types
1)simple delegate:which stores the address of the method.
2)multi cast delegate: which stored the address of multiple
methods.
Generally Delegates are used for EVENT HANDLING and GENERIC
ROUTINES
| Is This Answer Correct ? | 22 Yes | 3 No |
Answer / divya
Delegates are similar to function pointers in C C++,
Delegate objects hold references to functions.
Delgates are mainly used in event handling
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / anu1983_mca@yahoo.co.in
Delegate defines a reference type that can be used to
encapsulate a method.Delegate is a function pointer in c++.
I. Delegate is a Type-Safe and secure
| Is This Answer Correct ? | 12 Yes | 2 No |
Answer / asin
Delegate is a Function Pointer.It invokes methods.
References to methods are wrapped in delegates.
| Is This Answer Correct ? | 15 Yes | 9 No |
Answer / divyesh
Nobody has written the actual scenario where the delegates
will be used instead of events!
| Is This Answer Correct ? | 6 Yes | 1 No |
Answer / subhransu
A delegate is a type-safe object that can point to another method (or possibly multiple methods) .
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / d.monisha caroline
Delegate is a reference type variable which holds reference
to a method,,,delegates are primarily used in c# programming
for implementing events and callbacks
| Is This Answer Correct ? | 4 Yes | 1 No |
Answer / cool
Delegate is a strong type function pointer and it passes the
method signature for the class and class that has this
signature can use this delegates.
This is similar to Pointers in C and C++.
If we use this delegates for single method then this is
single case and if the method declared to more than one
method then this is called as multicast delegate object
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / 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 |
What is equal c#?
How to implement a singleton design pattern in c#?
What is use of hashtable in c#?
Explain the clr triggers?
What is Nullable Type in c#
What is the difference between dictionary and hashtable in c#?
What is difference between destructor and finalize?
What is a namespace server?
What is the Difference between a sub and a function?
What is difference between int and int in c#?
Is goto statement supported in c#?
What is the correct way of declaring an xml namespace?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)