using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ThreadInfo { class Program { static void Main(string[] args) { Console.WriteLine("Demonstrating getting information about a thread"); Console.WriteLine("================================================"); // Get the current thread,and give it a name Thread mainThread = Thread.CurrentThread; mainThread.Name = "MainThread"; // Print out some stats about this thread. Console.WriteLine("Thread Name: {0}", mainThread.Name); Console.WriteLine("Has thread started?: {0}", mainThread.IsAlive); Console.WriteLine("Priority Level: {0}", mainThread.Priority); Console.WriteLine("Thread State: {0}", mainThread.ThreadState); Console.WriteLine("Current culture: {0}", mainThread.CurrentCulture); Console.WriteLine("Current UI culture: {0}", mainThread.CurrentUICulture); Console.WriteLine("Is thread-pool thread? {0}", mainThread.IsThreadPoolThread); } } }