Skip to content
ConsoleMonster
Interface

IInputSource

ConsoleMonster.Input

Namespace
ConsoleMonster.Input
Assembly
ConsoleMonster
Implements
IDisposable
Modifiers
abstract

A source of input events: the Windows console (WindowsConsoleInput), a VT terminal, the .NET console key reader, or a script (ScriptedInput) in tests and demos. Only one component reads at a time; get the source through ConsoleInput.Acquire, which enforces that.

Usage

Explore 16 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 5

Methods

public abstract InputEvent? Read(TimeSpan timeout, CancellationToken cancellationToken) #

Waits up to timeout for the next event.

Parameters

timeout System.TimeSpan required
The longest wait; TimeSpan.Zero polls.
cancellationToken System.Threading.CancellationToken required
Cancels the wait with OperationCanceledException.

Returns

InputEvent? The event, or null when the timeout passed without input.

Exceptions

Properties

public abstract string Name { get; } #

A short description for diagnostics, for example windows console (ReadConsoleInputW).