Console.TreatControlCAsInput Property

 

Gets or sets a value indicating whether the combination of the Control modifier key and C console key (Ctrl+C) is treated as ordinary input or as an interruption that is handled by the operating system.

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

static member TreatControlCAsInput : bool with get, set

Property Value

Type: System.Boolean

true if Ctrl+C is treated as ordinary input; otherwise, false.

Exception Condition
IOException

Unable to get or set the input mode of the console input buffer.

If the value of the TreatControlCAsInput property is false and Ctrl+C is pressed, the pressed keys are not stored in the input buffer and the operating system terminates the currently executing process. This is the default value.

System_CAPS_cautionCaution

Use this property judiciously because setting it to true has such a dramatic effect. Most users expect Ctrl+C to terminate a console application. If you disable the effect of Ctrl+C, the user must remember to use Ctrl+Break to terminate the application, which is a less familiar key combination.

The following example demonstrates the TreatControlCAsInput property.

No code example is currently available or this language may not be supported.

UIPermission

for modifying safe top-level windows and subwindows. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows

.NET Framework
Available since 2.0
Return to top
Show: