Skip to content
ConsoleMonster

API Reference

Struct

KeyChord

Namespace ConsoleMonster.Input
Assembly ConsoleMonster
Base ValueType
Implements
IEquatable<KeyChord>
Modifiers sealed

A key combination used by key bindings: either a key with exact modifiers (Ctrl+K, Shift+Tab, F1, PageDown) or a typed character (?, :, /) that matches however it was typed.

Inheritance

  • ValueType
  • KeyChord

Usage

Explore 9 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 2

Accepted by parameters 7

Constructors

KeyChord 2 overloads
public KeyChord(ConsoleKey key, KeyModifiers modifiers = None) #

Creates a key chord.

Parameters

key System.ConsoleKey requiredposition: 0
The key.
modifiers ConsoleMonster.Input.KeyModifiers = None optionalposition: 1
The modifiers.
public KeyChord(Char character) #

Creates a character chord.

Parameters

character System.Char requiredposition: 0
The character.

Methods

Equals 2 overloads
public Boolean Equals(KeyChord other) #
Returns: Boolean

Indicates whether the current object is equal to another object of the same type.

Parameters

other ConsoleMonster.Input.KeyChord requiredposition: 0
An object to compare with this object.

Returns

true if the current object is equal to the other parameter; otherwise, false.

public override Boolean Equals(Object? obj) #
Returns: Boolean

Indicates whether this instance and a specified object are equal.

Parameters

obj System.Object? requiredposition: 0
The object to compare with the current instance.

Returns

true if obj and this instance are the same type and represent the same value; otherwise, false.

public override Int32 GetHashCode() #
Returns: Int32

Returns the hash code for this instance.

Returns

A 32-bit signed integer that is the hash code for this instance.

public Boolean Matches(InputEvent input) #
Returns: Boolean

Whether an event is this chord.

Parameters

input ConsoleMonster.Input.InputEvent requiredposition: 0
The event.

Returns

True on a match.

public static Boolean op_Equality(KeyChord left, KeyChord right) #
Returns: Boolean

Equality.

Parameters

left ConsoleMonster.Input.KeyChord requiredposition: 0
The left chord.
right ConsoleMonster.Input.KeyChord requiredposition: 1
The right chord.

Returns

True when equal.

public static Boolean op_Inequality(KeyChord left, KeyChord right) #
Returns: Boolean

Inequality.

Parameters

left ConsoleMonster.Input.KeyChord requiredposition: 0
The left chord.
right ConsoleMonster.Input.KeyChord requiredposition: 1
The right chord.

Returns

True when different.

public static KeyChord Parse(String text) #
Returns: KeyChord

Parses Ctrl+K, Alt+Enter, Shift+Tab, F5, PgDn, Space or a single character such as ?. Modifier and key names are case-insensitive.

Parameters

text System.String requiredposition: 0
The text.

Returns

The chord.

public override String ToString() #
Returns: String

The chord as people write it: Ctrl+K, Shift+Tab, ?.

Returns

The name.

public static Boolean TryParse(String? text, out KeyChord chord) #
Returns: Boolean

Parses a chord; see KeyChord.Parse.

Parameters

text System.String? requiredposition: 0
The text.
chord ConsoleMonster.Input.KeyChord requiredposition: 1
The chord.

Returns

Whether the text is a chord.

Properties

public ConsoleKey Key { get; } #

The key, or 0 for a character chord.

public Char Char { get; } #

The character of a character chord, or '\0'.

public KeyModifiers Modifiers { get; } #

The modifiers of a key chord.

public Boolean IsCharacter { get; } #

Whether this is a character chord.