Check the state of the current thread
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| C# Code Snippets |
| See also |
| edit |
This C# code snippet checks the state of the current thread by examining the ThreadState property of the current thread.
class ThreadState { public static void Main() { Thread thread = Thread.CurrentThread; Console.WriteLine ("ThreadState: {0}", thread.ThreadState); } }
| Thread.CurrentThread.ThreadState (program output) |
| ThreadState: Running |