Created
November 14, 2012 19:16
-
-
Save pcibraro/4074119 to your computer and use it in GitHub Desktop.
Await in Foreach
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
public async Task<IEnumerable<SearchResult>> Get() | |
{ | |
var providers = this.locator.GetAllProviders(resource); | |
var allResults = new List<SearchResult>(); | |
foreach (var provider in providers) | |
{ | |
var results = await provider.Search("foo"); | |
allResults.AddRange(results); | |
} | |
return allResults; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment