dotnet / dotnet/dotnet-api-docs

"Cancel" flag

Open
#1,018 0 comments 0 reactions 0 assignees View on GitHub
area-System.Runtime dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Opposite to the document, my console application terminate only if e.Cancel is set to true.

Public Sub Main(ByVal Args() As String)
AddHandler Console.CancelKeyPress, AddressOf ConsoleCancelEventHandler
Do
'Other Logic
System.Threading.Thread.Sleep(1000)
Loop While True
End Sub

Public Sub ConsoleCancelEventHandler(sender As Object, e As ConsoleCancelEventArgs)
' Clean up logic
e.Cancel = True
End Sub

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 93ab5d38-0ca0-f2c5-767a-532392b1d352
* Version Independent ID: 944f05d3-7efa-17e4-88b5-e3a621d1e585
* Content: [Console.CancelKeyPress Event (System)](https://docs.microsoft.com/en-us/dotnet/api/system.console.cancelkeypress?view=netframework-4.7.2)
* Content Source: [xml/System/Console.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System/Console.xml)
* Product: **dotnet-api**
* GitHub Login: @rpetrusha
* Microsoft Alias: **ronpet**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.