Created
April 26, 2013 15:39
-
-
Save parmarnishant/5468199 to your computer and use it in GitHub Desktop.
async
This file contains hidden or 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
| IEnumerable<Task<Image>> tasks = s_Domains.Select(GetFavicon); | |
| // The IEnumerable from Select is lazy, so evaluate it to start the tasks | |
| tasks = tasks.ToList(); | |
| Task<Image[]> allTask = Task.WhenAll(tasks); | |
| Then, all we have left to do is await the allTask, and use its results: | |
| Image[] images = await allTask; | |
| foreach (Image eachImage in images) | |
| { | |
| AddAFavicon(eachImage); | |
| } |
This file contains hidden or 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
| _ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment