Created
April 29, 2012 00:49
-
-
Save alexsandro-xpt/2522945 to your computer and use it in GitHub Desktop.
Async CTP exemplo 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<int> SumPageSizesAsync(IList<Uri> uris) { | |
int total = 0; | |
int i = 0; | |
int n = 0; | |
foreach (var uri in uris) { | |
Console.WriteLine("{0} - {1}", ++n, DateTime.Now.ToString("yyyyMMddHHmmssffff")); | |
Console.WriteLine(string.Format("{0} Found {1} bytes ...", ++i, total)); | |
var wc = new WebClient(); | |
var data = await wc.DownloadDataTaskAsync(uri); | |
Console.WriteLine("{0} - {1}", n, DateTime.Now.ToString("yyyyMMddHHmmssffff")); | |
total += data.Length; | |
} | |
Console.WriteLine(string.Format("Found {0} bytes total", total)); | |
return total; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment