Thread.CurrentContext : Thread « System.Threading « C# / C Sharp by API






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);
    }
}

   
    
  








Related examples in the same category

1.new Thread()
2.Thread.Abort()
3.Thread.AllocateDataSlot
4.Thread.AllocateNamedDataSlot
5.Thread.CurrentCulture
6.Thread.CurrentThread
7.Thread.GetData
8.Thread.GetHashCode()
9.Thread.Interrupt()
10.Thread.IsAlive
11.Thread.IsBackground
12.Thread.Join()
13.Thread.Priority
14.Thread.ResetAbort()
15.Thread.SetData
16.Thread.Sleep
17.Thread.Start
18.Thread.ThreadState