Hi Guys
Question about string data
Data entered on the Console screen is declared as a string data, example is below. I wish to know whether it is appropriate to say that any type of data entered on the Console screen is realized as a string data by the computer. If not, please give an example.
string entryString;
entryString = Console.ReadLine();
Thank you
Posted Sep 4, 2007, 8:12 PM
Thank you Alan
AlanPosted Aug 31, 2007, 6:06 PM
No, it's only true in respect of the Console.ReadLine() method.
The Console.Read() method returns data character by character though it returns the integer value of the character rather than the character itself and doesn't return anything until the 'Enter' key is pressed.
The Console.Key() method returns a ConsoleKeyInfo object which contains information about the key pressed. For example:
ConsoleKeyInfo cki = Console.ReadKey();
char ch = cki.KeyChar;