Can anyone tell me difference between Console.ReadKey() and Console.ReadLine() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can anyone tell me difference between Console.ReadKey() and Console.ReadLine()

when I was using ReadKey here in sololearn it was throwing an exception so can anyone tell me difference

20th Dec 2016, 7:45 AM
Mohan Chandra
Mohan Chandra - avatar
7 Answers
+ 2
SoloLearn really isn't the best way to test code, because you can't input text during the program's execution
20th Dec 2016, 8:10 AM
Gabe Rust
Gabe Rust - avatar
+ 1
ReadKey reads a single character or keystroke, whereas ReadLine reads until there is a carriage return, or when the user types [Enter]
20th Dec 2016, 8:08 AM
Gabe Rust
Gabe Rust - avatar
0
um... one reads a key, and the other reads a line...
20th Dec 2016, 7:57 AM
Gabe Rust
Gabe Rust - avatar
0
SoloLearn probably tried to use a line of the as input for the ReadKey method
20th Dec 2016, 7:58 AM
Gabe Rust
Gabe Rust - avatar
0
ok but actual difference what is in between? readkey read a text only?
20th Dec 2016, 8:02 AM
Mohan Chandra
Mohan Chandra - avatar
0
remember I am ur first follower 😃
20th Dec 2016, 8:03 AM
Mohan Chandra
Mohan Chandra - avatar
0
OK thanks
20th Dec 2016, 8:10 AM
Mohan Chandra
Mohan Chandra - avatar