How can you set a default input value in a .net console app?
Here is some make-believe code:
Console.Write("Enter weekly cost: ");
string inp
You can use helper method like this:
public static string ReadWithDefaults(string defaultValue)
{
string str = Console.ReadLine();
return String.IsNullOrEmpty(str) ? defaultValue : str;
}
There's a much better way to do this now, check out Readline on nuget: https://www.nuget.org/packages/ReadLine
install-package Readline
var input = ReadLine.Read("Enter weekly cost: ", "135");
I like to use the console to write interactive tests, and having default values can really help things.