A Thread class is responsible for creating and managing a thread in multi-thread programming. It provides a
property known as
ThreadState to check the current state of the thread. The initial state of a thread is
Unstarted state.
Syntax:
public ThreadState ThreadState{ get; }
Return Value: This property returns the value that indicates the state of the current thread.
Below programs illustrate the use of
ThreadState property:
Example 1:
Output:
The name of the current state of the main thread is: Running
Example 2: