
Parallel Programming and Concurrency with C# 10 and .NET 6
By :

There are two types of scenarios where async code is usually introduced:
In this section, we will create some real-world examples that use async
and await
for each type of operation. Whether you are waiting for an external process to complete or performing CPU-intensive operations within your application, you can leverage asynchronous code to improve your application’s performance.
Let’s start by looking at some examples of I/O-bound operations.
When you are working with I/O-bound code that is constrained by file or network operations, your code should use async
and await
to wait for the operations to complete.
The .NET methods to perform network and file I/O are asynchronous, so the use of Task.Run
will not be necessary: