Compiler Error CS1502

Updated: July 2008

The best overloaded method match for 'name' has some invalid arguments

This error occurs when the argument types being passed to the method do not match the parameter types of that method. If the called method is overloaded, then none of the overloaded versions has a signature that matches the argument types being passed.

To resolve this problem, do one of the following:

  • Double-check the types of the arguments being passed. Make sure that they match the arguments of the method being called.

  • If appropriate, convert any mismatched parameters using the System.Convert Class.

  • If appropriate, cast any mismatched parameters to match the type that the method is expecting.

  • If appropriate, define another overloaded version of the method to match the parameter types that are being sent.

The following sample generates CS1502:

// CS1502.cs
namespace x
   public class a
      public a(char i)
      // try the following constructor instead
      // public a(int i)

      public static void Main()
         a aa = new a(2222);   // CS1502




July 2008

Revised error message text.

Content bug fix.

Community Additions