Introduction
Asynchronous and parallel programming are powerful techniques that can enhance the performance and responsiveness of your applications. In C#, these techniques are made simpler and more accessible through the use of keywords like async
and await
, and libraries like the Task Parallel Library (TPL).
Imagine you're signed up to help a non-profit company with a software project. Before the project kicks off, you decide to update your programming skills by developing a banking app. To practice your asynchronous programming skills, you're going implement asynchronous versions of helper classes that implement file backup and restore processes.
The topics covered in this module include:
- Introduction to asynchronous programming in C#.
- Implementing asynchronous file input and output in C#.
- Asynchronous access to web resources using
HttpClient
in C#. - Implementing parallel programming and asynchronous tasks in C#.
- Managing and handling exceptions in asynchronous and parallel tasks in C#.
- Implementing data parallelism in C# using
Parallel.ForEachAsync
andTask.WhenAll
.
After completing this module, you’ll be able to:
- Implement asynchronous programming in C# using the
async
andawait
keywords. - Perform asynchronous file input and output operations and access web resources asynchronously in C#.
- Use the Task Parallel Library (TPL) in C# for parallel programming and managing concurrent data structures.
- Identify common pitfalls in parallel programming and handle exceptions in async and parallel tasks.
- Implement data parallelism in a C# application as part of a hands-on exercise.