Table of Contents

Struct KeyId

Namespace
InteractiveReadLine.KeyBehaviors
Assembly
InteractiveReadLine.dll

An identity for a key, is equatable so that it can be used in a dictionary

public struct KeyId : IEquatable<KeyId>
Implements
Inherited Members

Constructors

KeyId(char)

Creates an identity that matches a character, regardless of the keys that produced it.

public KeyId(char c)

Parameters

c char

The character to match.

KeyId(ConsoleKey, bool, bool, bool)

Creates an identity matching a key pressed together with a particular set of modifiers.

public KeyId(ConsoleKey key, bool ctrl, bool alt, bool shift)

Parameters

key ConsoleKey

The key to match.

ctrl bool

Whether the Control key must be held.

alt bool

Whether the Alt key must be held.

shift bool

Whether the Shift key must be held.

Properties

Char

Gets the character this identity matches, or null when it matches a key rather than a character.

public readonly char? Char { get; }

Property Value

char?

HasAlt

Gets whether the Alt key must be held for this identity to match.

public readonly bool HasAlt { get; }

Property Value

bool

HasCtrl

Gets whether the Control key must be held for this identity to match.

public readonly bool HasCtrl { get; }

Property Value

bool

HasShift

Gets whether the Shift key must be held for this identity to match.

public readonly bool HasShift { get; }

Property Value

bool

Key

Gets the key this identity matches, or null when it matches a character rather than a key.

public readonly ConsoleKey? Key { get; }

Property Value

ConsoleKey?

Methods

Equals(KeyId)

Determines whether this identity matches the same keypress as another.

public bool Equals(KeyId other)

Parameters

other KeyId

Returns

bool

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

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

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

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

ToString()

Returns a readable description of the keypress, such as "Ctrl+Shift+Tab".

public override string ToString()

Returns

string