mscorlib(4.0.0.0) API with additions
System.ConsoleKeyInfo Struct Reference

Describes the console key that was pressed, including the character represented by the console key and the state of the SHIFT, ALT, and CTRL modifier keys. More...

Public Member Functions

 ConsoleKeyInfo (char keyChar, ConsoleKey key, bool shift, bool alt, bool control)
 Initializes a new instance of the T:System.ConsoleKeyInfo structure using the specified character, console key, and modifier keys. More...
 
override bool Equals (object value)
 Gets a value indicating whether the specified object is equal to the current T:System.ConsoleKeyInfo object. More...
 
bool Equals (ConsoleKeyInfo obj)
 Gets a value indicating whether the specified T:System.ConsoleKeyInfo object is equal to the current T:System.ConsoleKeyInfo object. More...
 
override int GetHashCode ()
 Returns the hash code for the current T:System.ConsoleKeyInfo object. More...
 

Static Public Member Functions

static bool operator== (ConsoleKeyInfo a, ConsoleKeyInfo b)
 Indicates whether the specified T:System.ConsoleKeyInfo objects are equal. More...
 
static bool operator != (ConsoleKeyInfo a, ConsoleKeyInfo b)
 Indicates whether the specified T:System.ConsoleKeyInfo objects are not equal. More...
 

Public Attributes

char KeyChar => _keyChar
 Gets the Unicode character represented by the current T:System.ConsoleKeyInfo object. More...
 
ConsoleKey Key => _key
 Gets the console key represented by the current T:System.ConsoleKeyInfo object. More...
 
ConsoleModifiers Modifiers => _mods
 Gets a bitwise combination of T:System.ConsoleModifiers values that specifies one or more modifier keys pressed simultaneously with the console key. More...
 

Detailed Description

Describes the console key that was pressed, including the character represented by the console key and the state of the SHIFT, ALT, and CTRL modifier keys.

Definition at line 5 of file ConsoleKeyInfo.cs.

Constructor & Destructor Documentation

◆ ConsoleKeyInfo()

System.ConsoleKeyInfo.ConsoleKeyInfo ( char  keyChar,
ConsoleKey  key,
bool  shift,
bool  alt,
bool  control 
)

Initializes a new instance of the T:System.ConsoleKeyInfo structure using the specified character, console key, and modifier keys.

Parameters
keyCharThe Unicode character that corresponds to the key parameter.
keyThe console key that corresponds to the keyChar parameter.
shifttrue to indicate that a SHIFT key was pressed; otherwise, false.
alttrue to indicate that an ALT key was pressed; otherwise, false.
controltrue to indicate that a CTRL key was pressed; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe numeric value of the key parameter is less than 0 or greater than 255.

Definition at line 35 of file ConsoleKeyInfo.cs.

Member Function Documentation

◆ Equals() [1/2]

override bool System.ConsoleKeyInfo.Equals ( object  value)

Gets a value indicating whether the specified object is equal to the current T:System.ConsoleKeyInfo object.

Parameters
valueAn object to compare to the current T:System.ConsoleKeyInfo object.
Returns
true if value is a T:System.ConsoleKeyInfo object and is equal to the current T:System.ConsoleKeyInfo object; otherwise, false.

Definition at line 62 of file ConsoleKeyInfo.cs.

◆ Equals() [2/2]

bool System.ConsoleKeyInfo.Equals ( ConsoleKeyInfo  obj)

Gets a value indicating whether the specified T:System.ConsoleKeyInfo object is equal to the current T:System.ConsoleKeyInfo object.

Parameters
objAn object to compare to the current T:System.ConsoleKeyInfo object.
Returns
true if obj is equal to the current T:System.ConsoleKeyInfo object; otherwise, false.

Definition at line 75 of file ConsoleKeyInfo.cs.

◆ GetHashCode()

override int System.ConsoleKeyInfo.GetHashCode ( )

Returns the hash code for the current T:System.ConsoleKeyInfo object.

Returns
A 32-bit signed integer hash code.

Definition at line 106 of file ConsoleKeyInfo.cs.

◆ operator !=()

static bool System.ConsoleKeyInfo.operator != ( ConsoleKeyInfo  a,
ConsoleKeyInfo  b 
)
static

Indicates whether the specified T:System.ConsoleKeyInfo objects are not equal.

Parameters
aThe first object to compare.
bThe second object to compare.
Returns
true if a is not equal to b ; otherwise, false.

Definition at line 99 of file ConsoleKeyInfo.cs.

◆ operator==()

static bool System.ConsoleKeyInfo.operator== ( ConsoleKeyInfo  a,
ConsoleKeyInfo  b 
)
static

Indicates whether the specified T:System.ConsoleKeyInfo objects are equal.

Parameters
aThe first object to compare.
bThe second object to compare.
Returns
true if a is equal to b ; otherwise, false.

Definition at line 89 of file ConsoleKeyInfo.cs.

Member Data Documentation

◆ Key

ConsoleKey System.ConsoleKeyInfo.Key => _key

Gets the console key represented by the current T:System.ConsoleKeyInfo object.

Returns
A value that identifies the console key that was pressed.

Definition at line 19 of file ConsoleKeyInfo.cs.

◆ KeyChar

char System.ConsoleKeyInfo.KeyChar => _keyChar

Gets the Unicode character represented by the current T:System.ConsoleKeyInfo object.

Returns
An object that corresponds to the console key represented by the current T:System.ConsoleKeyInfo object.

Definition at line 15 of file ConsoleKeyInfo.cs.

◆ Modifiers

ConsoleModifiers System.ConsoleKeyInfo.Modifiers => _mods

Gets a bitwise combination of T:System.ConsoleModifiers values that specifies one or more modifier keys pressed simultaneously with the console key.

Returns
A bitwise combination of the enumeration values. There is no default value.

Definition at line 23 of file ConsoleKeyInfo.cs.


The documentation for this struct was generated from the following file: