Threading in .NET

There are essentially two ways to take advantage of multithreading with .NET:

  • Create a new thread manually by using the System.Threading.Thread class.

  • Use a .NET type that has built-in support for asynchronous use. This includes the types used for file I/O, the XML Web service proxy class, and the Delegate type.

This section focuses on the second approach, which provides most of the benefits of custom threading and shields you from many of the risks. Later in the chapter, we’ll examine the first approach and custom threading.

Of course, it’s also worth noting that many parts of a .NET application gain the benefits of threading completely for free. When you use the .NET printing classes, for example, the PrintDocument.PrintPage event ...

Get Microsoft® .NET Distributed Applications: Integrating XML Web Services and .NET Remoting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.