API Reference
Class
Prompt`1
The base of every prompt. Prompt.Show picks the interaction mode: a rich inline prompt (or an overlay over a running live dashboard), a line-based question, an accessible numbered question, or, when nobody can answer, the default or a clear PromptUnavailableException. It never waits for input that cannot come.
Inheritance
- Object
- Prompt`1
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.
Accepted by parameters 1
- Method MenuContext.Ask``1
Type Parameters
- T
- The answer type.
Methods
public abstract String Describe(T? value) #Returns:
StringThe answer as text, for the summary line left in the scrollback.
Parameters
- value T?
- The answer.
Returns
The text.
public T? Show(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Returns:
T?Asks the question and returns the answer.
Parameters
- options ConsoleMonster.Interactive.InteractiveOptions? = null
- Options; null uses InteractiveOptions.Default.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the prompt.
Returns
The answer.
Exceptions
PromptCancelledException– The user cancelled.PromptUnavailableException– Nobody can answer and there is no default.
public Task<T?> ShowAsync(InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Returns:
Task<T?>Asks the question on a worker thread.
Parameters
- options ConsoleMonster.Interactive.InteractiveOptions? = null
- Options.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the prompt.
Returns
The answer.
public Boolean TryShow(out T? value, InteractiveOptions? options = null, CancellationToken cancellationToken = default) #Returns:
BooleanAsks the question; returns false instead of throwing when the user cancels.
Parameters
- value T?
- The answer.
- options ConsoleMonster.Interactive.InteractiveOptions? = null
- Options.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the prompt.
Returns
Whether an answer was given.
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?