Mega Code Archive

 
Categories / C# by API / System Threading
 

Thread CurrentContext

using System; using System.Threading; class Program {     static void Main(string[] args) {         Thread primaryThread = Thread.CurrentThread;         primaryThread.Name = "ThePrimaryThread";         Console.WriteLine("Name of current AppDomain: {0}", Thread.GetDomain().FriendlyName);         Console.WriteLine("ID of current Context: {0}", Thread.CurrentContext.ContextID);         Console.WriteLine("Thread Name: {0}", primaryThread.Name);         Console.WriteLine("Has thread started?: {0}", primaryThread.IsAlive);         Console.WriteLine("Priority Level: {0}", primaryThread.Priority);         Console.WriteLine("Thread State: {0}", primaryThread.ThreadState);     } }