No, you cannot. The
Console
methods
Code.Read
and
Console.ReadLine
do exactly what they do and nothing else.
The style of work with console simply makes no sense. The console is designed to work with a human operator who normally can clearly perceive and input lines, in worst case, some properly delimited words.
Theoretically speaking, you can get an input stream
System.Console.In
and operate it in byte-to-byte manner, see
http://msdn.microsoft.com/en-us/library/system.console.in.aspx[
^].
However, even that would make no sense. What makes sense is the following pattern: always use
Console.ReadLine
, read the whole string, assign it to the local variable and parse this string the way you want. Keep it simple and convenient to the user.
Also, let me tell you: in any practical sense, a dialog with the user in a console is unreliable; it's hard to process user's error, etc. Such dialogs are often used just for learning purposes by software engineering students. If you need more complex input, develop a windowed application, with a Window/Form and controls.
The usable application in 99.9% cases don't use
Console.ReadLine
or
Console.Read
at all. It simply expect all the information at once in a command line which is parsed during run time. If more data is expected from a user, an input file is used.
For command-line parsing, you are welcome to use my easy-to-use library
Enumeration-based Command Line Utility[
^].
—SA