Challenge: Convert Synchronous Method to Async
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 2
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Suggested prompts:
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Чудово!
Completion показник покращився до 5.56
Challenge: Convert Synchronous Method to Async
Свайпніть щоб показати меню
Завдання
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.
Рішення
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 1. Розділ 2
single