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
ccharThe 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
keyConsoleKeyThe key to match.
ctrlboolWhether the Control key must be held.
altboolWhether the Alt key must be held.
shiftboolWhether 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
HasCtrl
Gets whether the Control key must be held for this identity to match.
public readonly bool HasCtrl { get; }
Property Value
HasShift
Gets whether the Shift key must be held for this identity to match.
public readonly bool HasShift { get; }
Property Value
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
Methods
Equals(KeyId)
Determines whether this identity matches the same keypress as another.
public bool Equals(KeyId other)
Parameters
otherKeyId
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
public override bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current instance.
Returns
- bool
true if
objand 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()