What is the difference between Read(),ReadLine() and ReadKey() Method in .Net

Summary:

Read(), ReadLine() and ReadKey() are basically static methods, and they comes under the Console class. That's why we use these methods like:

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

Now Lets see what is the differences in all these methods:

Console.ReadLine():-- method accept the String and return the string as well.

Console.Read():--method accept the String but return Integer.

Finally...

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

By,
Yogendra Kumar
 

Ebook Download
View all
Learn
View all