...

/

Asynchronous Methods

Asynchronous Methods

Create methods that can run asynchronously.

Introduction

We’ve seen how to perform some actions asynchronously using the Task class. Asynchronous execution allows us to delegate some parts of our program to background pool threads. If we have a method that has some asynchronous code inside, how can we inform its users that it’s asynchronous? How can others call this method asynchronously without encapsulating it inside a Task instance? Consider the following example:

public void Print()
{
	string
...