Method ToString
ToString(ConsoleKeyInfo)
Returns a string representation of the ConsoleKeyInfo suitable for debugging and logging.
public static string ToString(this ConsoleKeyInfo consoleKeyInfo)
Parameters
consoleKeyInfoConsoleKeyInfoThe ConsoleKeyInfo to convert to string.
Returns
- string
A formatted string showing the key, character, and modifiers.
Remarks
Examples:
Key: A ('a')- lowercase 'a' pressedKey: A ('A'), Modifiers: Shift- uppercase 'A' pressedKey: A (\0), Modifiers: Control- Ctrl+A (no printable char)Key: Enter (0x000D)- Enter key (carriage return)Key: F5 (\0)- F5 function keyKey: D2 ('@'), Modifiers: Shift- Shift+2 on US keyboardKey: None ('é')- Accented characterKey: CursorUp (\0), Modifiers: Shift | Control- Ctrl+Shift+Up Arrow