I have a list of tasks, which i'd like to wait for. I'm waiting like
await TaskEx.WhenAll(MyViewModel.GetListOfTasks().ToArray());
MyViewModel.GetListOfTasks() returns List of Task:
var tasksList = new List<Task>();
foreach (var item in Items)
{
tasksList.Add(item.MyTask());
}
Now, i'd like to return dummy task, which would be done immediately. However, TaskEx.WhenAll would wait it forever:
public Task<bool> MyTask()
{
return new Task<bool>(() => false);
}
How can i return Task, which would be finished instantly?
question from:
https://stackoverflow.com/questions/19846507/return-taskbool-instantly 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…