What is the difference between Read(), ReadKey() and ReadLine() in C#?

Difference Between 

Read(), ReadKey() and ReadLine() in C#:



Read(), ReadKey() and ReadLine() in C#: are basically static methods, and they belongs to Console class. So we declare these methods as follows:

Declaration in Application for 

Read  :  Console.Read();
Readline() :  Console.Readline();
ReadKey() :  Console.ReadKey();

Summary:

Console.ReadLine():-- Accept the string value and return the string value.

Console.Read():-- Accept the string and return Integer.


Console.ReadKey():-- Accept the Character and return ASCII value of that character.



  • The above methods are mainly used in Console application and these are used for return the different values .
  • If we use Read line or Read() we need press Enter button to come back to code.
  • If we use Read key() we can press any key to come back code in application.