can I print some default text on the console when doing a ReadLine?
A silly example below shows two small scenarios. In the first a user
is told what he appears to be called, and asks for a name.
In the second case I want the the user to be able to just press return
to accept the username of the system. (I understand it does not work
the way I do it below - I just want to illustrate what I want).
Thanks,
P9K
---------
using System;
using System.Text;
namespace FeedMeName
{
class Program
{
static void Main(string[] args)
{
string name1 = Environment.UserName;
Console.WriteLine("Are you '{0}'?", name1);
Console.Write("name please >");
name1 = Console.ReadLine();
Console.WriteLine("Hello '{0}'!", name1);
string name2 = Environment.UserName;
Console.WriteLine("Are you '{0}'?.", name2);
Console.Write("name please >");
Console.Write(name2);
Console.CursorLeft -= name2.Length;
name2 = Console.ReadLine();
Console.WriteLine("Hello '{0}'!", name2);
}
}
}
---------
>FeedMeName.exeAre you 'per'?
name please >my name is foobar
Hello 'my name is foobar'!
Are you 'per'?.
name please >foobar, goddamit
Hello 'foobar, goddamit'!
---------
>FeedMeName.exeAre you 'per'?
name please >fo
Hello 'fo'!
Are you 'per'?.
name please >brr
Hello 'br'!