Scheduling threads
The Thread.Start
method schedules a Thread
to start. You can overload this method with different parameters. We will look at two examples in this section. The first example will call the Thread.Start()
method without passing any parameters, and the second will call Thread.Start(object)
.
We will now write the code as follows:
- Add a class called
Job
as follows:internal class Job { public void Execute() { Console.WriteLine( "Execute() method execute."); } public void PrintMessage(object message) { Console.WriteLine($"Message: {message}"); } }
This class provides two methods that will be used in our Thread
scheduling...