The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Compiler Error CS1502

The best overloaded method match for 'declaration' 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
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft