Awaiting multiple Tasks with different results

后端 未结 10 1387
醉话见心
醉话见心 2020-11-22 12:59

I have 3 tasks:

private async Task FeedCat() {}
private async Task SellHouse() {}
private async Task BuyCar() {}
         


        
10条回答
  •  孤街浪徒
    2020-11-22 13:32

    Just await the three tasks separately, after starting them all.

    var catTask = FeedCat();
    var houseTask = SellHouse();
    var carTask = BuyCar();
    
    var cat = await catTask;
    var house = await houseTask;
    var car = await carTask;
    

提交回复
热议问题