Article ID: 311156 - Last Review: July 29, 2002 - Revision: 1.0 PRB: "Invalid Argument" Error Message When You Compile a Visual C# .NET Console ApplicationThis article was previously published under Q311156 SYMPTOMS
When you compile a Visual C# .NET console application, you may receive the following error message:
error CS1502: The best overloaded method match for 'declaration' has some invalid arguments
error CS1503: Argument 'arg': cannot convert from 'type1' to 'type2'
CAUSE
The argument types that are passed to the function do not match the parameter types of that function. If the called function is overloaded, none of the overloaded versions has a signature that matches the argument types that are passed.
RESOLUTION
To resolve this problem, do any of the following:
STATUSThis behavior is by design. MORE INFORMATION
In the following sample Visual C# .NET console application, the Test function has two overloaded versions. The first version takes only an int type. The second version expects an int type as its first argument and a string type as its second argument. However, in the Main function, the first argument that is passed (nNum) is a string type. Neither of the two overloaded Test functions takes a string type as the first parameter.
| Article Translations
|

Back to the top
