Read a character from the keyboard : Console Input Output : Development Class C# Source Code


Custom Search

C# Source Code » Development Class » Console Input Output »

 

Read a character from the keyboard









    

/*
C#: The Complete Reference 
by Herbert Schildt 

Publisher: Osborne/McGraw-Hill (March 8, 2002)
ISBN: 0072134852
*/
// Read a character from the keyboard. 
 
using System; 
 
public class KbIn {   
  public static void Main() { 
    char ch; 
 
    Console.Write("Press a key followed by ENTER: "); 
 
    ch = (char) Console.Read(); // get a char 
    
    Console.WriteLine("Your key is: " + ch); 
  }   
}

           
       
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Development Class
» Console Input Output