Task<string>[] tableOfWebClientTasks = new Task<string>[taskCount];
for (int i = 0; i < taskCount; i++)
{
tableOfWebClientTasks[i] = new WebClient().DownloadStringTask(allUrls[count - i - 1]);
}
Task.Factory.ContinueWhenAll(tableOfWebClientTasks, tasks =>
{
Parallel.ForEach(tasks, task =>
{
//Here I have result from each task.
//But information which url is executed on this task, is lost.
});
});
たとえば、クラス (2 つのパブリック プロパティ、1 つはタスク用、もう 1 つは URL 用) を作成し、インスタンスを返すことができます。しかし、この方法は他の方法と接続しました。
この問題の解決策はありますか?