Performance Tips for Asynchronous Development in C#: Listing 1.
Revised Click event handler.
private void button1_Click(object sender, EventArgs e)
private async void UpdateTime()
button1.Enabled = false;
for (var x = 0; x < 15; x++)
this.Text = DateTime.Now.ToString("HH:mm:ss");
button1.Enabled = true;
Patrick Steele is a senior .NET developer with Billhighway in Troy, Mich. A recognized expert on the Microsoft .NET Framework, he’s a former Microsoft MVP award winner and a presenter at conferences and user group meetings.