async
and await
In this chapter you’ll:
Understand what asynchronous programming is and how it can improve the performance of your apps.
Use the async
modifier to indicate that a method is asynchronous.
Use an await
expression to wait for an asynchronous task to complete execution so that an async
method can continue its execution.
Take advantage of multicore processors by executing tasks asynchronously via Task Parallel Library (TPL) features.
Use Task
method WhenAll
to wait for multiple tasks to complete before an async
method continues.
Time multiple tasks running on a single-core system and a dual-core system (all with the same processor speeds) to determine the performance improvement when these tasks are run on the dual-core system.
Use an HttpClient
to invoke a web service asynchronously.
Show an asynchronous task’s progress and intermediate results,