Wednesday, November 23, 2011

Difference between Read(),Readline() and ReadKey in C#

Title:Difference between Read(),Readline() and ReadKey in C#

These methods can be used to read the values from the console and done some specific functionality on it.Each of the property is used to return the different values .The declaration of  static methods in console application as below

Read()        :accept the string value and return the string value.
Readline() :Accept the string and return Integer
ReadKey() : Accept the character and return Character

Declaration In Application:
If we use Read line or Read() we need press Enter button to come back to code.If we using Read key() we can press any key to come back code in application

1 comment:

Rajeev Sharma said...

It is wrong the Read() accepts string and return a value.. not the ReadLine()..