我在http://blogs.msdn.com/b/pfxteam/archive/2012/08/02/processing-tasks-as-they-complete.aspx查看示例,但需要与以下代码相当的vb。我尝试了各种但没有运气。下面是我坚持转换的代码。
var tasks = new[] {
Task.Delay(3000).ContinueWith(_ => 3),
Task.Delay(1000).ContinueWith(_ => 1),
Task.Delay(2000).ContinueWith(_ => 2),
Task.Delay(5000).ContinueWith(_ => 5),
Task.Delay(4000).ContinueWith(_ => 4),
};
答案 0 :(得分:1)
没有一个编译器方便确保,但我认为这应该让你非常接近:
Dim tasks =
{ Task.Delay(3000).ContinueWith(Function(_) 3),
Task.Delay(1000).ContinueWith(Function(_) 1),
Task.Delay(2000).ContinueWith(Function(_) 2),
Task.Delay(5000).ContinueWith(Function(_) 5),
Task.Delay(4000).ContinueWith(Function(_) 4),
}