I'm a bit confused when it comes to the async/await stuff in .NET...
Consider the following method:
public async Task DoSomething() {
IEnumerable<Task> ts = GetSomeTasks(); // Some tasks that would do some random IO stuff, or whatever
await Task.WhenAll(ts);
Console.WriteLine("All tasks completed!");
}
Is the call to Console.WriteLine
guaranteed to be executed after the tasks in ts
have been awaited? I think I've seen cases where await doesn't seem to "block" like that until the task result is accessed. What rules apply?