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);
  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.
1, 2 and 3 only
1, 3 and 5 only
2 and 4 only
4 only
All of the above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
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.

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

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:

Your comments will be displayed after verification.