Summary
In this chapter, we learned some useful techniques for improving client application performance. We started by exploring some different uses of async
and await
in the ViewModel of a WPF application. In that project, we saw that awaiting Task.WhenAll
does not block the main thread, which keeps the UI responsive to user input. We discussed how Task.Run
and Task.Factory.StartNew
can be used to call synchronous code from asynchronous code, making it easier to introduce managed threading to existing applications. We finished up the chapter by learning some techniques to update the UI thread from other threads without causing exceptions at runtime.
You should be feeling more comfortable using async
, await
, and the TPL in your code after reading this chapter. Try taking what you have learned here and start adding some async
code to your own client applications. For additional reading on async
and await
, you can check out this C# article on Microsoft Docs: https://docs.microsoft...