|That method isn't
async; it blocks the caller, and then returns a result wrapped in a
If you make it
async, you can use
await Task.Delay(5000); instead of
Thread.Sleep(5000);, and the caller will be able to continue after the loop has finished.
To let the caller continue before the loop has finished, you'd need to yield control before starting the loop.
private static async Task<int> GetSomeData()
int x = 0;
for (; x < 900_000_000; x++)
A Tour of Task, Part 10: Promise Tasks[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."