AntiHeroKid
Why does Task 1 prints first instead of Task 3 - Async & Await
like task 1 is download images
task 2 is download videos
task 3 is upload whatever data you currently downloaded
you would want task 3 i.e. uploading to happen once task 1 and task 2 are completed.
46 replies
Why does Task 1 prints first instead of Task 3 - Async & Await
i used to be confused about this as well. But the thing is
await
here is helping us to run the code sequentially in the sense that it is going to wait for secondTask to complete (even though thirdTask and fourthTask may have compeleted already)46 replies
Why does Task 1 prints first instead of Task 3 - Async & Await
Task secondTask = ConsoleWithDelayAsync("Task 2",150); Task thirdTask = ConsoleWithDelayAsync("Task 3",9); Task fourthTask = ConsoleWithDelayAsync("Task 4",80);They have began running concurrently.
46 replies