Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ConsoleKeyInfo Constructor (Char, ConsoleKey, Boolean, Boolean, Boolean)

 

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

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
ConsoleKeyInfo(
	wchar_t keyChar,
	ConsoleKey key,
	bool shift,
	bool alt,
	bool control
)

Parameters

keyChar
Type: System::Char

The Unicode character that corresponds to the key parameter.

key
Type: System::ConsoleKey

The console key that corresponds to the keyChar parameter.

shift
Type: System::Boolean

true to indicate that a SHIFT key was pressed; otherwise, false.

alt
Type: System::Boolean

true to indicate that an ALT key was pressed; otherwise, false.

control
Type: System::Boolean

true to indicate that a CTRL key was pressed; otherwise, false.

Exception Condition
ArgumentOutOfRangeException

The numeric value of the key parameter is less than 0 or greater than 255.

This type is not intended to be created by users. Instead, it is returned to the user in response to calling the Console::ReadKey method.

The ConsoleKeyInfo type does not specify whether the left or right SHIFT, ALT, or CTRL modifier key was pressed.

.NET Framework
Available since 2.0
Return to top
Show:
© 2017 Microsoft