using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int n; Console.ReadLine(n); Console.WriteLine(n); } } } 

why it writes an error: none of the overloads of ReadLine (n); doesn't take 1 argument?

  • Why did you put the visual studio tag? Question about language, not on Wednesday - Pavel Mayorov

3 answers 3

Console.ReadLine cannot accept any arguments. That is, remove n .

Usage example

 String s; s = Console.ReadLine(); Console.WriteLine("Line: {0}", s); 
  • @Denis Thank you! - Ryslandeveloper
  • @ryslandeveloper is not at all) I advise you to use MSDN next time if there is a problem with the use of functions. There everything is described in detail and even with examples. - ExiD
  • understood, I will use msdn. - Ryslandeveloper

It works the other way around.

 n = Convert.ToInt32(ConsoleReadLine()) 

Theory Practice

    Another example:

     static void Main(string[] args) { int n; // Проверка на корректность ввода с кла-вы. if(!int.TryParse(Console.ReadLine(), out n)) { Console.WriteLine("Не могу преобразовать введённое значение"); } else { Console.WriteLine(n); } Console.ReadLine(); }