Date: 02/10/07 (C Sharp) Keywords: no keywords Is there anything wrong with the following to emulate getch() (aside from not handling exceptions) using .NET 2.0? using System; public class Input { static void Main(string[] args) { char ch = getch(); Console.WriteLine("You entered: {0}", ch); } static char getch() { ConsoleKeyInfo cki = Console.ReadKey(true); return cki.KeyChar; } }
|