16.6. Summary

Thread-related classes and delegates are defined in the System.Threading namespace. The four ways to create threads in C# are as follows:

  1. Manually creating threads. This approach gives the most flexibility because the creator of the thread can control the thread's attributes. This approach is also how Java programmers create threads. But because the onus of managing the life cycle of the thread is on the programmer, this approach of creating threads should be avoided if possible. Improperly managing the life of the thread could cannibalize system resources.

  2. Using the System.Threading.ThreadPool class. This is the recommended approach to creating threads because it exploits the system-specified ThreadPool class, which takes care ...

Get .NET for Java Developers: Migrating to C# 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.