What is the Method Signature in the following
int DoSomething(int a, int b);
Return type is a part of signature or not???
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Return type is not part of the method signature in C#. Only the method name and its parameters types (but not the parameter names) are part of the signature. You cannot, for example, have these two methods:
To be clear: Methods cannot be overloaded based on their return type. They must have a unique name, unique parameter types, or pass their arguments differently (e.g. using
outorref).Edit: To answer your original question, the method signature for your method is:
Note that this all applies to normal methods. If you’re talking about
delegates, then you should see keyboardP’s answer. (Short version: return type IS part of the signature for a delegate).