Read a character from the keyboard. : Console Read : Development C# Examples


C# Examples » Development » Console Read »

 

Read a character from the keyboard.









    
using  System;  
  
class  MainClass  {      
    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);  
    }      
}
    
   
  
   



Output

Press a key followed by ENTER:
Your key is:


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Console Read