Interface
ILineConsole
ConsoleMonster.Interactive
Line-based input and output for InteractionMode.Line and InteractionMode.Accessible prompts: the console by default, or a PowerShell host (Host.UI.ReadLine, PromptForChoice) in remoting and the ISE.
Usage
Explore 3 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 1
- Property InteractiveOptions.LineConsole
Accepted by parameters 2
- Extension method InteractiveOptions.LineConsole
- Method InteractiveOptionsFluent.LineConsole
Methods
public abstract int? Choose(string caption, string message, IReadOnlyList<string> choices, int defaultIndex) #Lets the host ask a choice question natively (PowerShell's PromptForChoice). Return null to fall back to a numbered list.
Parameters
- caption string
- The question.
- message string
- Extra text, or empty.
- choices System.Collections.Generic.IReadOnlyList<string>
- The choice labels.
- defaultIndex int
- The default choice, or -1.
Returns
int? The chosen index, or null when not supported.public abstract string? ReadLine() #Reads a line; null when the input ended.
Returns
string? The line.public abstract string? ReadSecret() #Reads a line without echoing it; null when the input ended.
Returns
string? The secret.public abstract void Write(string text) #Writes text without ending the line (the question before an answer).
Parameters
- text string
- The text.