Reading Console Input : Console Read : Development C# Examples


C# Examples » Development » Console Read »

 

Reading Console Input






Console.In is an instance of TextReader.
Console.In defines two input methods: Read() and ReadLine().

To read a single character, use the Read() method:




    
static  int  Read()
    
   
  
   

To read a string of characters, use the ReadLine() method:




    
static  string  ReadLine()
    
   
  
   


ReadLine() reads characters until you press ENTER
ReadLine() returns these characters in a string object.
ReadLine() will throw an IOException on failure.




HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Development
» Console Read