API Reference
Class
ConsoleKeyInput
Reads keys through Console.ReadKey, which decodes the terminal's VT input on Linux and macOS. Used where the Windows console API is not available. Pastes arrive as single characters and focus changes are not reported; resizes are detected by polling the window size.
Inheritance
- Object
- ConsoleKeyInput
Constructors
Methods
public Void Dispose() #Returns:
VoidPerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public static InputEvent FromKeyInfo(ConsoleKeyInfo info) #Returns:
InputEventConverts a .NET key record into an input event.
Parameters
- info System.ConsoleKeyInfo
- The key record.
Returns
The event.
public InputEvent? Read(TimeSpan timeout, CancellationToken cancellationToken) #Returns:
InputEvent?Waits up to timeout for the next event.
Parameters
- timeout System.TimeSpan
- The longest wait; TimeSpan.Zero polls.
- cancellationToken System.Threading.CancellationToken
- Cancels the wait with OperationCanceledException.
Returns
The event, or null when the timeout passed without input.
Exceptions
InputClosedException– The input ended (end of a script, closed stdin).
Inherited Methods
public virtual Boolean Equals(Object? obj) #Returns:
BooleanInherited from Object
Parameters
- obj Object?
Properties
public String Name { get; } #A short description for diagnostics, for example windows console (ReadConsoleInputW).