CS1503
C# Programming Language
Severity: MinorWhat Does This Error Mean?
CS1503 means you called a method and passed an argument of the wrong type. The error tells you which argument number caused the problem and what types were involved. For example: a method expects a string but you passed an int, or it expects a DateTime but you passed a plain string. The fix is to either convert the value to the expected type, or check if you are calling the right method.
Affected Models
- .NET Framework
- .NET Core
- .NET 5+
- Visual Studio
- Visual Studio Code
- Rider
Common Causes
- Passing an int where a string is expected, or a string where an int is expected
- Passing the arguments in the wrong order — method expects (name, age) but you passed (age, name)
- Passing a value that is slightly the wrong numeric type — for example a double where a float is expected
- Passing a derived class object to a method that expects a different, unrelated type
- Passing null to a method argument that is not nullable in the current context
How to Fix It
-
Hover over the method name in Visual Studio. A tooltip shows the full method signature — the expected type for each parameter. Compare it to what you are passing.
The tooltip shows something like 'void Console.WriteLine(string value)' — that tells you it needs a string, not an int or object.
-
Note the argument number in the error — 'argument 2' means the second value in your method call. Count your arguments to find the one that is wrong.
Arguments are numbered starting from 1. If it says argument 2, look at the second value inside the parentheses of your method call.
-
Convert the value to the expected type before passing it. Use .ToString() for numbers to string, or int.Parse() for string to int, or an explicit cast for numeric conversions.
Example: if a method needs a string but you have an int, pass myInt.ToString() instead of myInt.
-
Check that you are calling the right overload of the method. Many methods have multiple versions that accept different types. You may be accidentally targeting the wrong one.
In Visual Studio, press Ctrl+Shift+Space inside a method call to see all available overloads and their parameter types.
-
Check if your arguments are in the correct order. A method expecting (string name, int age) is very different from passing (int age, string name) — even if both compile errors look similar.
Compare your argument order to the parameter order shown in the method signature tooltip.
When to Call a Professional
CS1503 is a compile-time error you can fix yourself. Hover over the method call in Visual Studio to see the expected parameter types in a tooltip. The error message specifies the argument number — count to that argument in your method call to find the problem.
Frequently Asked Questions
What does 'argument 1' and 'argument 2' mean in the error message?
It refers to the position of the value in your method call. Example: MyMethod(firstArg, secondArg, thirdArg) — argument 1 is firstArg, argument 2 is secondArg, argument 3 is thirdArg. Find that position in your code to locate the value with the wrong type. Check what type you have versus what the method expects.
Why does passing a number to a method that expects a string cause an error?
C# requires explicit conversions between unrelated types to prevent unintended behavior. A number is not automatically converted to its text representation unless you explicitly call .ToString(). This prevents accidental type mismatches — if you meant to pass the number 42, and the method takes a string, C# wants you to be intentional: pass '42'.ToString() or use $'{42}'
Can I have a method that accepts multiple types for the same parameter?
Yes — this is done through method overloading (multiple methods with the same name but different parameters) or by using generics. Example: Console.WriteLine() has overloads for string, int, double, object, and more. You can also use the 'object' type to accept anything, but then you lose type safety inside the method. Generics (like List<T>) give you type safety with flexibility.