03/12/2011
Whats New in C# 5.0 Part-2
With the proposed new features, the asynchronous version of the code will instead look like this: public async Task<int> SumPageSizesAsync(IList<Uri> uris) { int total = 0; foreach (var uri in uris) { statusText.Text = string.Format("Found {0} bytes ...", total); var data = await new WebClient().DownloadDataAsync(uri); total += data.Length; } statusText.Text = string.Format("Found {0} bytes total",