0

Suppose we have this scenario:

In a database, there are Car1, Car2, Car3. To get these objects, we will do three queries. But, instead doing :

Car car1 = await ApiHelper.GetCar1();
Car car1 = await ApiHelper.GetCar2();
Car car1 = await ApiHelper.GetCar3();

I need them to run parallel(for performance issues) :

Task<Car> car1 = await ApiHelper.GetCar1();
Task<Car> car1 = await ApiHelper.GetCar2();
Task<Car> car1 = await ApiHelper.GetCar3();

Now is the question: what is the best practice to find out that all Tasks are completed ?

Alex Huiculescu
  • 129
  • 2
  • 11

0 Answers0