Mega Code Archive

 
Categories / C# Tutorial / Development
 

How to read a character entered using the keyboard

class MainClass {   public static void Main()   {     System.Console.Write("Enter a character: ");     char myChar = (char) System.Console.Read();     System.Console.WriteLine("You entered " + myChar);   } } Enter a character: q You entered