📜  typescript foreach async await - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:20.736000             🧑  作者: Mango

代码示例6
public async Task RunAsync()
{
    var tasks = new List();
 
    foreach (var x in new[] { 1, 2, 3 })
    {
        var task = DoSomethingAsync(x);
        tasks.Add(task);
    }
 
    await Task.WhenAll();
}