The async/await includes a few operators to help with parallel composition, such as WhenAll
and WhenAny
.
var taskA = someCall(); // Note: no await
var taskB = anotherCall(); // Note: no await
// Wait for both tasks to complete.
await Task.WhenAll(taskA, taskB);
// Retrieve the results.
var resultA = taskA.Result;
var resultB = taskB.Result;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…