How to read a character entered using the keyboard : Console Read : Development C# Examples


C# Examples » Development » Console Read »

 

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);

    }

}
    
   
  
   



Output

Enter a character:     q
You entered


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Console Read