I read many articles on async and await(mostly from msdn - which is good actually). There is still one question that bothers me and I could not find the answer.
If there is an await statement on a task then the control is returned to its caller until it is awaited again in the caller. In that case is this time consuming task getting executed in a separate thread? If not then how is it getting executed parallel to the main thread.
async Task<string> GetContentsAsync()
{
int sample = 0;
HttpClient client = new HttpClient();
Task<string> contents = client.GetStringAsync("http://www.microsoft.com");
string data = await contents;
return data;
}
I hope my question is clear.