Created
December 6, 2011 09:17
-
-
Save biac/1437510 to your computer and use it in GitHub Desktop.
FeedReader: 並列処理の実装
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<IList<FeedData>> ReadAsync(string[] feedUrlStrings) | |
{ | |
List<Task<FeedData>> taskList = new List<Task<FeedData>>(feedUrlStrings.Length); | |
// タスク開始のループ | |
foreach (string url in feedUrlStrings) | |
taskList.Add(this.ReadAsync(url)); | |
List<FeedData> result = new List<FeedData>(feedUrlStrings.Length); | |
// タスクから結果を取り出すループ | |
foreach (Task<FeedData> task in taskList) | |
result.Add(await task); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment