diff --git a/.openpublishing.redirection.csharp.json b/.openpublishing.redirection.csharp.json index 7b12bcb3e04cb..cd854aa2d8684 100644 --- a/.openpublishing.redirection.csharp.json +++ b/.openpublishing.redirection.csharp.json @@ -1826,6 +1826,10 @@ "source_path_from_root": "/docs/csharp/misc/cs1007.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/overload-resolution" }, + { + "source_path_from_root": "/docs/csharp/language-reference/compiler-messages/cs1502.md", + "redirect_url": "/dotnet/csharp/misc/cs1503" + }, { "source_path_from_root": "/docs/csharp/misc/cs1510.md", "redirect_url": "/dotnet/csharp/language-reference/compiler-messages/ref-modifiers-errors" diff --git a/docs/csharp/language-reference/compiler-messages/cs1502.md b/docs/csharp/language-reference/compiler-messages/cs1502.md deleted file mode 100644 index ee494cef258b0..0000000000000 --- a/docs/csharp/language-reference/compiler-messages/cs1502.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -description: "Compiler Error CS1502" -title: "Compiler Error CS1502" -ms.date: 07/20/2015 -f1_keywords: - - "CS1502" -helpviewer_keywords: - - "CS1502" -ms.assetid: f302f00a-5fe1-4e42-b91c-f185d6311671 ---- -# Compiler Error CS1502 - -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 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: - -```csharp -// 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 - } - } -} -``` diff --git a/docs/csharp/language-reference/toc.yml b/docs/csharp/language-reference/toc.yml index 1e4ef81c0dec8..9aaea86ee02e4 100644 --- a/docs/csharp/language-reference/toc.yml +++ b/docs/csharp/language-reference/toc.yml @@ -1471,7 +1471,7 @@ items: - name: CS1113 href: ../misc/cs1113.md - name: CS1502 - href: ./compiler-messages/cs1502.md + href: ../misc/cs1503.md - name: CS1503 href: ../misc/cs1503.md - name: CS1504 diff --git a/docs/csharp/misc/cs1503.md b/docs/csharp/misc/cs1503.md index 8a38e766db74b..e81bb52135c68 100644 --- a/docs/csharp/misc/cs1503.md +++ b/docs/csharp/misc/cs1503.md @@ -4,12 +4,35 @@ title: "Compiler Error CS1503" ms.date: 07/20/2015 f1_keywords: - "CS1503" + - "CS1502" helpviewer_keywords: - "CS1503" + - "CS1502" ms.assetid: 65e4c63d-928d-49f5-8fac-8e113b07e128 --- # Compiler Error CS1503 -Argument 'number' cannot convert from TypeA to TypeB - - The type of one argument in a method does not match the type that was passed when the class was instantiated. This error typically appears along with CS1502. See [CS1502](../language-reference/compiler-messages/cs1502.md) for a discussion of how to resolve this error. +Argument 'argument' cannot convert from TypeA to TypeB + +The type of one argument in a method does not match the type that was passed when the class was instantiated. + +The following sample generates CS1503: + +```csharp +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); // CS1503 + } + } +} +```