Possible Duplicate: Is Async await keyword equivalent to a ContinueWith lambda?
Edit:
I see this question has been marked as a duplicate, but it's not quite the same. I'm specifically asking about whether await is the equivalent of ContinueWith IN CONJUNCTION WITH TaskContinuationOptions.AttachedToParent
Is this (inside an async method body)
await SomeMethodAsync();
Console.WriteLine("hi");
The equivalent to
Task.ContinueWith(delegate() {
Console.WriteLine("hi");
}, TaskContinuationOptions.AttachedToParent);
}
?
The only answer I could find on Google says that these are not equivalent, but I don't believe it because -
In the first example the async method body returns the Task to the user as soon as it hits the first await, and if the task was not waiting on the child task (because of AttachedToParent option) then it would be completed already.
My sanity depends on this being the case.
The answer I found on Google is here http://social.msdn.microsoft.com/Forums/en-US/async/thread/bec2151a-abfd-43b9-a2e0-ffe34ae481f6/