Table of Contents

Constructor Key

Namespace
Terminal.Gui
Assembly
Terminal.Gui.dll

Key()

Constructs a new Key

public Key()

Key(KeyCode)

Constructs a new Key from the provided Key value

public Key(KeyCode k)

Parameters

k KeyCode

The key

Key(Key)

Copy constructor.

public Key(Key key)

Parameters

key Key

The Key to copy

Key(char)

Constructs a new Key from a char.

public Key(char ch)

Parameters

ch char

Remarks

The key codes for the A..Z keys are encoded as values between 65 and 90 (A through Z). While these are the same as the ASCII values for uppercase characters, they represent *keys*, not characters. Therefore, this constructor will store 'A'..'Z' as A.. Z with the ShiftMask set and will store `a`..`z` as A..Z.

Key(string)

Constructs a new Key from a string describing the key. See TryParse(string, out Key) for information on the format of the string.

public Key(string str)

Parameters

str string

The string describing the key.

Key(int)

Constructs a new Key from an integer describing the key. It parses the integer as Key by calling the constructor with a char or calls the constructor with a KeyCode.

public Key(int value)

Parameters

value int

The integer describing the key.

Remarks

Don't rely on value passed from A to Z because would not return the expected keys from 'a' to 'z'.

Exceptions

ArgumentOutOfRangeException
ArgumentException