How it works...

In the preceding code, we saw the void returning type asynchronous method that was used in the button1_Click event. We also created a Task returning method that returns nothing (that would be a void if used in synchronous programming), but returning a Task type allows us to await the method. Finally, we created a Task<TResult> returning method that performs a task and returns the result to the calling code.