← Back to Home • Next: Confirm — Operations →
Confirm returns the same IKeyPressControl as KeyPress, so it exposes the
identical fluent API. Rather than duplicate it here, this page summarises the methods and links
to the full reference on the KeyPress → Methods page.
The factory is
PromptPlus.Controls.Confirm(string prompt = "", string? description = null, bool showresult = false), which returnsIKeyPressControl. It differs fromKeyPress(...)only in that the culture Yes/No keys are pre-registered as valid keys.
IKeyPressControl Confirm(string prompt = "", string? description = null, bool showresult = false)
| Parameter | Meaning |
|---|---|
prompt |
The prompt text shown to the user. Default empty. |
description |
An optional description line shown under the prompt. Default null. |
showresult |
When true, the answer line stays on screen after the control finishes; when false (default) it is hidden after finish. |
PromptPlus.Controls.Confirm("Apply changes", "Press Y or N").Run();
| Method | Purpose | Full reference |
|---|---|---|
AddValidKey |
Register an additional valid key (accumulates on top of the pre-set Yes/No keys) | KeyPress → AddValidKey |
ShowMessage |
Message shown for a rejected key | KeyPress → ShowMessage |
ShowMessageAsync |
Async message for a rejected key | KeyPress → ShowMessageAsync |
Styles |
Recolor a KeyPressStyles region |
KeyPress → Styles |
Options |
Per-control behavior overrides | KeyPress → Options |
Run |
Display and return ResultPrompt<ConsoleKeyInfo?> |
KeyPress → Run |
Because Confirm already registers the Yes/No keys, calling
AddValidKeyadds more accepted keys — it does not replace the yes/no pair. For a plain yes/no question you normally call none of these except optionallyOptions,Styles, andRun.
using PromptPlusLibrary;
var confirm = PromptPlus.Controls
.Confirm("Delete file?")
.Options(o => o.ShowTooltip(true))
.Run();
Reading the result (yes/no) is covered on the Index page.
KeyPressStyles regions