Boris Eetgerink

June 19, 2023

Recommended NuGet package: Prompt

Today I needed something apparently simple. I wanted to set a console input (ReadLine) which displays a default value. Unfortunately, .NET has no support for this out-of-the-box. After trying a few libraries I settled on Prompt. It does just what I need and not much more. There's always room for improvement and it's old, but it still works like a charm:

using PromptLibrary;

int id = Prompt.Ask<int>("Id");
string? answer = Prompt.Ask("Question", "The quick brown fox...");
Prompt.Say($"Id: {id}, Answer: {answer}");

Thanks, Talles!

About Boris Eetgerink

Hey, thanks for reading my blog. Subscribe below for future posts like this one and check my personal site in order to contact me.