C# Programming - Delegates - Discussion

Discussion :: 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);
  1. On declaring the delegate a class called del will get created.
  2. The signature of del need not be same as the signature of the method that we intend to call using it.
  3. The del class will be derived from the MulticastDelegate class.
  4. The method that can be called using del should not be a static method.
  5. The del class will contain a one-argument constructor and an lnvoke() method.

[A]. 1, 2 and 3 only
[B]. 1, 3 and 5 only
[C]. 2 and 4 only
[D]. 4 only
[E]. All of the above

Answer: Option B

Explanation:

No answer description available for this question.

Mandava.bm said: (Sep 30, 2011)  
Please can any body explain. I think class and delegate are two different things.

Syedkhaleel said: (Nov 17, 2011)  
Is this the correct answer? if yes how it is.

Amazon said: (Jan 4, 2012)  
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

Inceptos said: (Jul 30, 2012)  
Yes Amazon is right the signature must match in order to implement the delegates on a class's method.

Mahesh.P said: (Dec 8, 2014)  
-->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.

Rajat Shukla said: (Apr 1, 2019)  
No, The signature of the delegate should be same as the signature of the method declared.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.