Skip to content
ConsoleMonster
Class

ConsoleLineConsole

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Implements
ILineConsole
Modifiers
sealed

The ILineConsole over Console: standard input and output.

Inheritance

  • object
  • ConsoleLineConsole

Usage

Explore 1 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

Constructors

public ConsoleLineConsole() #

Methods

public 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 string? ReadLine() #

Reads a line; null when the input ended.

Returns

string? The line.
public string? ReadSecret() #

Reads a line without echoing it; null when the input ended.

Returns

string? The secret.
public void Write(string text) #

Writes text without ending the line (the question before an answer).

Parameters

text string required
The text.
public void WriteLine(string text) #

Writes a line.

Parameters

text string required
The text.

Properties

public static ConsoleLineConsole Instance { get; } #

The shared instance.