C#.net: Difference between ReadLine(), Read(), ReadKey()
As MSDN is actually pretty clear
Console.ReadLine()
Reads the next line of characters from the standard input stream. simply you can say, it read all the ***characters ***from user input. (and finish when press enter)
***Note: ***it return a STRING so data type should be STRING
Example
When i enter a string "This is ReadLine" it read as it is. its mean*** it reads all characters until the end of line.***
Console.Read()
Reads the next character from the standard input stream. it only accept single character from user input and return its ASCII Code.
***Note: *** Data type should be int. because it return an integer value as ASCII.
**Example **
As I input "6" and it return its ASCII value "54.
**Console.ReadKey() **
It obtains the next character or function key pressed by the user. In simple words, it read that which key is pressed by user and return its name. it does not require to press enter key before entering.
***Note: ***it is STRUCT Data type which is ConsoleKeyInfo.
**Example: **
as I press different Buttons from keyboard like Escape, Spacebar, Enter, R, P, Z, Minus it will return the name.
Thanks for reading this article, hope you enjoyed it.