Skip to content
Enes Okullu edited this page Aug 14, 2024 · 1 revision

Constructor of ConsoleKeyInfo

ConsoleKeyInfo has a default constructor ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool ctrl). While combination of modifiers are not common to use, here is an additional constructor with setting modifiers default false.

ConsoleKeyInfo(char keyChar, ConsoleKey key);

Returns ConsoleKeyInfo

KeyActionPairList

This is public list of Tuple values of ConsoleKeyInfo and Action. List is public to use List's additional features which is not available on HelpConsole yet. KeyActionPairList is a list of Tuple<ConsoleKeyInfo, Action>

AddKeyActionPair

AddKeyActionPair(ConsoleKeyInfo cki, Action action);
  • ConsoleKeyInfo cki: ConsoleKeyInfo which is created by default or additional constructor that will be used to pair Key-Action.
  • Action action: Action that will be called when given cki is paired with a value in KeyActionPairList.

ListKeyActionPairList

Listing of Tuple values of KeyActionPairList.

ListKeyActionPairList();

ClearActionKeyPairList

Clears list of KeyActionPairList.

ClearKeyActionPairList();

WaitKeyAction

WaitKeyAction();

Wait for a key to be pressed and read it via Console.ReadKey() then call KeyAction(ConsoleKeyInfo cki) to call given Action which is defined on KeyActionPairList.

KeyAction

KeyAction(ConsoleKeyInfo cki);

Call given action if it has a key with given cki on KeyActionPairList, if not writes on debug output.

Clone this wiki locally