This lesson introduced the techniques that will enable you to create applications that can run tasks in the background. It discussed the Asynchronous Pattern for components, and classes in the System.Threading namespace.
The key points to remember are:
-
Some components expose the
ProgessChanged event. You can use this to provide feedback on the status of an asynchronous task. -
You must not create too many threads because each thread must load and save its context every time it is switched in and out.
-
You should take care when you apply a lock, because threads may form a queue while they wait for a lock to be released. This problem is reduced if the code in question is executed as an atomic unit.
use of the Asynchronous Pattern and the multithreading support of the System.Threading namespace components by working through practical examples.
You should now be able to:
-
Invoke the asynchronous methods of some components and controls to increase the perceived performance for users.
-
Use the Thread class to run tasks on separate threads to enable the main thread to dedicate itself to the maintenance of the User Interface (UI).