public async Task<int> DoWorkExplicitTasks()
{
int count = 0;
Task<int> countTask = GetCountAsync("x");
int result = await countTask;
count = count + result;
Console.WriteLine("X Count is " + count);
return count;
}
/// <summary> /// Runs all 3 variations of the Simple code to ensure /// they all have the same result /// </summary> /// <returns></returns> static async Task SimpleMainAsync() { var worker = new SimpleAsyncWorker(); await worker.DoWork(); await worker.DoWorkExplicitTasks(); await worker.DoWorkWithoutAwait(); }