Taskとasync・awaitの比較?

  • タグ:
  • タグはありません
private async void Button_Click(object sender, RoutedEventArgs e)
{
    var client = new WebClient();
    var html = await client.DownloadStringTaskAsync(this.Url.Text);
    this.Output.Text = html;
}

//↓

private void Button_Click(object sender, RoutedEventArgs e)
{
    Task.Factory.StartNew(() => {
        var client = new WebClient();
        var html = await client.DownloadString(this.Url.Text);
        this.Output.Text = html;
    });
}