C# Programming - Delegates - Discussion
Discussion Forum : Delegates - General Questions (Q.No. 4)
4.
Which of the following statements are correct about the delegate declaration given below?
delegate void del(int i);
- On declaring the delegate a class called del will get created.
- The signature of del need not be same as the signature of the method that we intend to call using it.
- The del class will be derived from the MulticastDelegate class.
- The method that can be called using del should not be a static method.
- The del class will contain a one-argument constructor and an lnvoke() method.
Discussion:
6 comments Page 1 of 1.
Rajat Shukla said:
6 years ago
No, The signature of the delegate should be same as the signature of the method declared.
Mahesh.P said:
1 decade ago
-->The CLR provides an "Invoke method" for each delegate.
-->Use of this method is, You do not have to call this method explicitly from C#, Visual Basic, or Visual C++, because the compilers call it automatically.
-->Use of this method is, You do not have to call this method explicitly from C#, Visual Basic, or Visual C++, because the compilers call it automatically.
Inceptos said:
1 decade ago
Yes Amazon is right the signature must match in order to implement the delegates on a class's method.
Amazon said:
1 decade ago
This answer is incorrect as Any method that matches the delegate's signature, which consists of the return type and parameters, can be assigned to the delegate.
Refer:
http://msdn.microsoft.com/en-us/library/ms173171(v=vs.80).aspx
Refer:
http://msdn.microsoft.com/en-us/library/ms173171(v=vs.80).aspx
Syedkhaleel said:
1 decade ago
Is this the correct answer? if yes how it is.
Mandava.bm said:
1 decade ago
Please can any body explain. I think class and delegate are two different things.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers