Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error CS1502 

Error Message

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

Community Additions

© 2015 Microsoft