0
where am I mistake?
namespace Restart { class Program { static void Main(string[] args) { int num; int age; TestMethod(out num, out age); Console.WriteLine(num,age); Console.ReadKey(); } static void TestMethod(out int x, out int y) { x = 12; y = 2; } } }
2 ответов
+ 3
Also you can use it in this syntax:
Console.WriteLine (String , Object) where the String is used as format.e.g.
int Age = 35;
String Name ="John Doe";
Console.WriteLine("Your name is {0} and you are {1} years old", Name, Age);
The {0} and {1} represents index of arguments following the format string.
0
the first thing to do is using "toString()" method on num variable (the same with age), when you write:
Console.WriteLine(num,age);
and also put a + sign instead of come, here is correction:
Console.WriteLine(num.toString() + " " + age.toString());
or you could write like that:
Console.WriteLine(num.toString());
Console.WriteLine(age.toString());