Export (0) Print
Expand All

ConsoleKeyInfo.ConsoleKeyInfo Constructor

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 (
	char keyChar,
	ConsoleKey key,
	bool shift,
	bool alt,
	bool control
)
public ConsoleKeyInfo (
	char keyChar, 
	ConsoleKey key, 
	boolean shift, 
	boolean alt, 
	boolean control
)
public function ConsoleKeyInfo (
	keyChar : char, 
	key : ConsoleKey, 
	shift : boolean, 
	alt : boolean, 
	control : boolean
)
Not applicable.

Parameters

keyChar

The Unicode character that corresponds to the key parameter.

key

The console key that corresponds to the keyChar parameter.

shift

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

alt

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

control

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

Exception typeCondition

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.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft