Development · Native API migration preview · Coverage validation in progress Published release →

API Browser

Struct

ConsoleKeyInfo

struct ConsoleKeyInfo

Module: System
Assembly: System.Runtime.dll
Source file: ConsoleKeyReader.rvn

Inheritance: Object → ValueType → ConsoleKeyInfo
Implements: EquatableTo<ConsoleKeyInfo>

A decoded key value. TextScalar is a Unicode scalar, not a grapheme or an allocated String.

Remarks

Shift is reported only when explicitly encoded; uppercase text alone does not imply Shift. Legacy terminals cannot distinguish Tab from Ctrl+I, Enter from Ctrl+M or Backspace from Ctrl+H. Compiler-generated self-equality interface compares all fields, including the active TextScalar case and scalar value. Equal keys have equal hashes; None, Some(0) and an uninitialized Optional are distinct.

A key value containing logical key identity, reported modifiers and optional Unicode scalar text. TextScalar is not a grapheme or an allocated String.

Development equality compares all fields, including the active TextScalar case and payload. Equal keys have equal hashes. None, Some(0) and uninitialized Optional storage remain distinct. Explicit boxing still allocates a value box.

Complete equality and hash member reference includes both operator signatures. The pinned renderer currently gives == and != the same generated URL, so that manual entry is authoritative for their signatures.

The compiler supplies EquatableTo<ConsoleKeyInfo> automatically. Typed interface calls use the generated equality method; the record uses ordinary value-type layout and interface dispatch.

Constructors

1 item
ConsoleKeyInfo(Key: ConsoleKey, Shift: bool, Alt: bool, Control: bool, TextScalar: Optional<int>) A decoded key value. TextScalar is a Unicode scalar, not a grapheme or an allocated String.

Properties

5 items
Alt: bool Whether Alt was reported, including the selected legacy Escape-prefix convention.
Control: bool Whether Control was reported.
Key: ConsoleKey Logical key identity.
Shift: bool Whether Shift was explicitly reported; uppercase alone does not imply Shift.
TextScalar: Optional<int> Optional Unicode scalar, not a grapheme or allocated String.

Methods

6 items
Equals(other: ConsoleKeyInfo) -> bool Compares key identity, modifiers, and the TextScalar case and payload by value. Implements EquatableTo<ConsoleKeyInfo>.Equals
Equals(obj: object?) -> bool Returns true when the object is an equal ConsoleKeyInfo; null and other types return false. Overrides Object.Equals
GetHashCode() -> int Returns a hash consistent with value equality across all fields and the active TextScalar case. Overrides Object.GetHashCode
GetType() -> TypeInfo Returns metadata for the concrete runtime type of this instance. Inherited from Object.GetType
ToString() -> string No summary available. Overrides Object.ToString

Operators

2 items
Static member: operator ==(left: ConsoleKeyInfo, right: ConsoleKeyInfo) -> bool Compares all key fields, including the active optional scalar payload, by value.
Static member: operator !=(left: ConsoleKeyInfo, right: ConsoleKeyInfo) -> bool Returns true when any key field or optional scalar case or payload differs.