, async
let compiler , , , , , main
( UI).
async-wait, :
, "" WinForm, .
:
private Task SomeUIOperation()
{
return Task.Run(() =>
{
this.Invoke(new Action(() => this.BackColor = Color.Aquamarine));
Thread.Sleep(10000);
this.Invoke(new Action(() => this.BackColor = Color.Gray));
});
}
private async void button1_Click(object sender, EventArgs e)
{
await SomeUIOperation();
}
async-await
, 10 .
, async-wait, , , - , , .
And the console application is not the best type of project for testing and training Async-Await
source
share