Mega Code Archive

 
Categories / C# Tutorial / Development
 

Get name of current AppDomain and context ID

using System; using System.Threading; class MainClass {   // [MTAThread]   [STAThread]   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);   } } Name of current AppDomain: main.exe ID of current Context: 0