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, this is my C# .NET blog. I don't have a comments system, but you can contact me at boriseetgerink at hey dot com.