Skip to content
ConsoleMonster
Interface

ILineConsole

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
abstract

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

Accepted by parameters 2

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 required
The question.
message string required
Extra text, or empty.
choices System.Collections.Generic.IReadOnlyList<string> required
The choice labels.
defaultIndex int required
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 required
The text.
public abstract void WriteLine(string text) #

Writes a line.

Parameters

text string required
The text.