Mega Code Archive

 
Categories / C# Tutorial / Development
 

Read a string from the keyboard, using Console In directly

using System;     class MainClass {    public static void Main() {      string str;        Console.WriteLine("Enter some characters.");        str = Console.In.ReadLine(); // call TextReader's ReadLine() method        Console.WriteLine("You entered: " + str);    }  } Enter some characters. qwer You entered: qwer