Challenge: Convert Synchronous Method to Async
Uppgift
Swipe to start coding
Refactor the provided synchronous DownloadFile method so that it becomes asynchronous using async and await. The current version blocks the thread for 3 seconds to simulate a file download.
- Modify the method so that it does not block the calling thread.
- Replace the blocking call with an asynchronous alternative that simulates a 3-second delay.
- Ensure the method uses the correct async method signature and is called appropriately from
Main.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 2
single
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal
Fantastiskt!
Completion betyg förbättrat till 5.56
Challenge: Convert Synchronous Method to Async
Svep för att visa menyn
Uppgift
Swipe to start coding
Refactor the provided synchronous DownloadFile method so that it becomes asynchronous using async and await. The current version blocks the thread for 3 seconds to simulate a file download.
- Modify the method so that it does not block the calling thread.
- Replace the blocking call with an asynchronous alternative that simulates a 3-second delay.
- Ensure the method uses the correct async method signature and is called appropriately from
Main.
Lösning
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 1. Kapitel 2
single