Class Key
- Namespace
- Bunit
- Assembly
- Bunit.Web.dll
Representation of keyboard key that can be argument of keyboard events.
public sealed class Key : IEquatable<Key>
- Inheritance
-
Key
- Implements
- Inherited Members
- Extension Methods
Properties
Add
Gets a Key that represents the number pad addition key.
public static Key Add { get; }
Property Value
Alt
Gets a Key that represents the Alt key. This is a control key and it can be combined with other keys. E.g. Key.Enter + Keys.Alt.
public static Key Alt { get; }
Property Value
AltKey
Gets a value indicating whether Alt key is pressed.
public bool AltKey { get; }
Property Value
Backspace
Gets a Key that represents the Backspace key.
public static Key Backspace { get; }
Property Value
Code
Gets the string that identifies the physical key being pressed. The value is not affected by the current keyboard layout or modifier state, so a particular key will always return the same value.
public string Code { get; }
Property Value
Command
Gets a Key that represents the function key Command. This is a control key and it can be combined with other keys. E.g. Key.Enter + Key.Command.
public static Key Command { get; }
Property Value
CommandKey
Gets a value indicating whether Command key is pressed.
public bool CommandKey { get; }
Property Value
Control
Gets a Key that represents the Control key. This is a control key and it can be combined with other keys. E.g. Key.Enter + Key.Control.
public static Key Control { get; }
Property Value
ControlKey
Gets a value indicating whether Control key is pressed.
public bool ControlKey { get; }
Property Value
Delete
Gets a Key that represents the Delete key.
public static Key Delete { get; }
Property Value
Divide
Gets a Key that represents the number pad division key.
public static Key Divide { get; }
Property Value
Down
Gets a Key that represents the down arrow key.
public static Key Down { get; }
Property Value
End
Gets a Key that represents the End key.
public static Key End { get; }
Property Value
Enter
Gets a Key that represents the Enter key.
public static Key Enter { get; }
Property Value
Equal
Gets a Key that represents the equal sign key.
public static Key Equal { get; }
Property Value
Escape
Gets a Key that represents the Escape key.
public static Key Escape { get; }
Property Value
F1
Gets a Key that represents the function key F1.
public static Key F1 { get; }
Property Value
F10
Gets a Key that represents the function key F10.
public static Key F10 { get; }
Property Value
F11
Gets a Key that represents the function key F11.
public static Key F11 { get; }
Property Value
F12
Gets a Key that represents the function key F12.
public static Key F12 { get; }
Property Value
F2
Gets a Key that represents the function key F2.
public static Key F2 { get; }
Property Value
F3
Gets a Key that represents the function key F3.
public static Key F3 { get; }
Property Value
F4
Gets a Key that represents the function key F4.
public static Key F4 { get; }
Property Value
F5
Gets a Key that represents the function key F5.
public static Key F5 { get; }
Property Value
F6
Gets a Key that represents the function key F6.
public static Key F6 { get; }
Property Value
F7
Gets a Key that represents the function key F7.
public static Key F7 { get; }
Property Value
F8
Gets a Key that represents the function key F8.
public static Key F8 { get; }
Property Value
F9
Gets a Key that represents the function key F9.
public static Key F9 { get; }
Property Value
Home
Gets a Key that represents the Home key.
public static Key Home { get; }
Property Value
Insert
Gets a Key that represents the Insert key.
public static Key Insert { get; }
Property Value
Left
Gets a Key that represents the left arrow key.
public static Key Left { get; }
Property Value
Multiply
Gets a Key that represents the number pad multiplication key.
public static Key Multiply { get; }
Property Value
NumberPad0
Gets a Key that represents the number pad 0 key.
public static Key NumberPad0 { get; }
Property Value
NumberPad1
Gets a Key that represents the number pad 1 key.
public static Key NumberPad1 { get; }
Property Value
NumberPad2
Gets a Key that represents the number pad 2 key.
public static Key NumberPad2 { get; }
Property Value
NumberPad3
Gets a Key that represents the number pad 3 key.
public static Key NumberPad3 { get; }
Property Value
NumberPad4
Gets a Key that represents the number pad 4 key.
public static Key NumberPad4 { get; }
Property Value
NumberPad5
Gets a Key that represents the number pad 5 key.
public static Key NumberPad5 { get; }
Property Value
NumberPad6
Gets a Key that represents the number pad 6 key.
public static Key NumberPad6 { get; }
Property Value
NumberPad7
Gets a Key that represents the number pad 7 key.
public static Key NumberPad7 { get; }
Property Value
NumberPad8
Gets a Key that represents the number pad 8 key.
public static Key NumberPad8 { get; }
Property Value
NumberPad9
Gets a Key that represents the number pad 9 key.
public static Key NumberPad9 { get; }
Property Value
NumberPadDecimal
Gets a Key that represents the number pad decimal separator key.
public static Key NumberPadDecimal { get; }
Property Value
PageDown
Gets a Key that represents the Page Down key.
public static Key PageDown { get; }
Property Value
PageUp
Gets a Key that represents the Page Up key.
public static Key PageUp { get; }
Property Value
Pause
Gets a Key that represents the Pause key.
public static Key Pause { get; }
Property Value
Right
Gets a Key that represents the right arrow key.
public static Key Right { get; }
Property Value
Shift
Gets a Key that represents the Shift key. This is a control key and it can be combined with other keys. E.g. Key.Enter + Key.Shift.
public static Key Shift { get; }
Property Value
ShiftKey
Gets a value indicating whether Shift key is pressed.
public bool ShiftKey { get; }
Property Value
Space
Gets a Key that represents the Spacebar key.
public static Key Space { get; }
Property Value
Subtract
Gets a Key that represents the number pad subtraction key.
public static Key Subtract { get; }
Property Value
Tab
Gets a Key that represents the Tab key.
public static Key Tab { get; }
Property Value
Up
Gets a Key that represents the up arrow key.
public static Key Up { get; }
Property Value
Value
Gets the key value of the key represented. If the value has a printed representation, this attribute's value is the same as the char attribute.
public string Value { get; }
Property Value
Methods
Combine(Key?)
Gets a combination of current key with another key. A key instance can be combined only with Control, Shift, Alt, or Command keys.
public Key Combine(Key? key)
Parameters
key
KeyThe other key to combine with.
Returns
- Key
A new key with combination of Control, Shift, Alt, and Command keys.
Equals(Key?)
Gets the value indicating whether the current object is equal to another object of the same type.
public bool Equals(Key? other)
Parameters
other
KeyA key to compare with this object.
Returns
- bool
True
if the current object is equal to the other parameter; otherwise,false
.
Equals(object?)
Gets the value indicating whether the current object is equal to another object of the same type.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with this object.
Returns
- bool
True
if the current object is equal to the other parameter; otherwise,false
.
Get(char)
Gets a Key object from specified character.
public static Key Get(char value)
Parameters
value
charThe key value.
Returns
Get(string)
Gets a Key object with specified value.
public static Key Get(string value)
Parameters
value
stringThe key value.
Returns
Get(string, string)
Gets a Key object with specified value and code.
public static Key Get(string value, string code)
Parameters
Returns
GetHashCode()
Gets hash code of this object.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
ToString()
Gets a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
WithAltKey(bool)
Gets the key with new value of Alt key.
public Key WithAltKey(bool value)
Parameters
value
boolNew value of Alt key.
Returns
- Key
The key with new value of Alt key.
WithCommandKey(bool)
Gets the key with new value of Command key.
public Key WithCommandKey(bool value)
Parameters
value
boolNew value of Command key.
Returns
- Key
The key with new value of Command key.
WithControlKey(bool)
Gets the key with new value of Control key.
public Key WithControlKey(bool value)
Parameters
value
boolNew value of Control key.
Returns
- Key
The key with new value of Control key.
WithShiftKey(bool)
Gets the key with new value of Shift key.
public Key WithShiftKey(bool value)
Parameters
value
boolNew value of Shift key.
Returns
- Key
The key with new value of Shift key.
Operators
operator +(Key, Key?)
Gets a combination of 2 key objects. A key instance can be combined only with Control, Shift, Alt, or Command keys.
public static Key operator +(Key x, Key? y)
Parameters
Returns
- Key
A new key with combination of Control, Shift, Alt, and Command keys.
operator ==(Key?, Key?)
Gets the value indicating whether 2 instances of Key are equal.
public static bool operator ==(Key? x, Key? y)
Parameters
Returns
- bool
True
if the instances of Key are equal; otherwise,false
.
implicit operator KeyboardEventArgs(Key)
Gets a new Key instance with value of character.
public static implicit operator KeyboardEventArgs(Key key)
Parameters
key
KeyThe character to convert to Key instance.
Returns
- KeyboardEventArgs
The Key instance with character value.
implicit operator Key(char)
Gets a new Key instance with value of character.
public static implicit operator Key(char key)
Parameters
key
charThe character to convert to Key instance.
Returns
- Key
The Key instance with character value.
implicit operator Key(string)
Gets a new Key instance with value of string object.
public static implicit operator Key(string value)
Parameters
value
stringThe string value to convert to Key instance.
Returns
- Key
The Key instance with the specified value.
operator !=(Key?, Key?)
Gets the value indicating whether 2 instances of Key are different.
public static bool operator !=(Key? x, Key? y)
Parameters
Returns
- bool
True
if the instances of Key are different; otherwise,false
.