The simplest and easiest way of creating threads is via the Thread class, which is defined in the System.Threading namespace. This approach has been used since the arrival of .NET version 1.0 and it works with .NET core as well. To create a thread, we need to pass a method that the thread needs to execute. The method can either be parameter-less or parameterized. There are two delegates that are provided by the framework to wrap these functions:
- System.Threading.ThreadStart
- System.Threading.ParameterizedThreadStart
We will learn both of these through examples. Before showing you how to create a thread, I will try to explain how a synchronous program works. Later on, we will introduce multithreading so that we understand the ...