Console.CancelKeyPress Event
Assembly: mscorlib (in mscorlib.dll)
This event is used in conjunction with System.ConsoleCancelEventHandler and System.ConsoleCancelEventArgs. The CancelKeyPress event enables a console application to intercept the CTRL+C signal so the application can decide whether to continue executing or terminate. For more information about handling events, see Consuming Events.
Use this event to explicitly control how your application responds to the CTRL+C signal. If your application has simple requirements, you can use the TreatControlCAsInput property instead of this event.
The event handler for this event is executed on a thread pool thread.
- UIPermission
for modifying safe top-level windows and subwindows. Associated enumeration: UIPermissionWindow.SafeTopLevelWindows
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.