As you can see in this code:
public async void TaskDelayTest() { while (LoopCheck) { for (int i = 0; i < 100; i++) {
If you're going to poll, poll on a CancellationToken:
CancellationToken
public async Task TaskDelayTestAsync(CancellationToken token) { for (int i = 0; i < 100; i++) { textBox1.Text = i.ToString(); await Task.Delay(TimeSpan.FromSeconds(1), token); } }
For more information, see the cancellation documentation.