-3

Picture

Exception on english: "Argument 1: cant convert "int" into "string".

But in my parametrs and arguments I used only "int" type.

How can I typed my parameters (X and Y) used WriteLine method?

eightShirt
  • 1,457
  • 2
  • 15
  • 29
Snobya_KNB
  • 35
  • 4
  • Click on "Picture" to show screen on my problem. – Snobya_KNB Dec 16 '16 at 17:12
  • 2
    That is a compiler error, not an exception. Screenshots are frowned upon on this site. In Visual Studio, click on View and click "Error List" to show the list of errors. Then right click on the error and go to "Copy", then edit your post and paste in the error and erase any useless information. Like this: "Error CS1503 Argument 1: cannot convert from 'int' to 'string'". – Quantic Dec 16 '16 at 17:22
  • The issue is the first parameter should be a String Format (https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx). Just use `Console.WriteLine("3 " + x);` to display the two numbers side by side with a space between them. You can also add dashes `Console.WriteLine("3-" + x);` if you want to separate them in that way. – user1274820 Dec 16 '16 at 18:00

1 Answers1

0

Add an explicit .ToString, e.g.

Console.WriteLine(3.ToString());

Or use string.format:

Console.WriteLine(String.Format("{0}, {1}", a, b));

(Amongst others).

negacao
  • 1,244
  • 8
  • 17