Task<string> t = wc.DownloadStringTaskAsync(url);
//create other tasks
//...
//...
//at this point I would like to know the url that was supplied for a task
我在Task中找不到任何API,它会返回用于创建任务的Action或Func参数。
答案 0 :(得分:2)
编辑:由于它不存储此信息,您只需自己完成,这是微不足道的。
var myTaks = new Dictionar<string, Task>();
myTasks.Add(url, wc.DownloadStringTaskAsync(url);
//Do the same for some other urls.
var thatOneTaskImLookingFor = wc[url];