CurrentThread: Name, ApartmentState, IsAlive, Priority, ThreadState : Current Thread « Thread « C# / CSharp Tutorial






using System;
using System.Threading;

class MainClass
{
  // [MTAThread]
  [STAThread]
  static void Main(string[] args)
  {
    Thread primaryThread = Thread.CurrentThread;

    primaryThread.Name = "ThePrimaryThread";

    Console.WriteLine("Thread Name: {0}", primaryThread.Name);
    Console.WriteLine("Alive: {0}", primaryThread.IsAlive);
    Console.WriteLine("Priority Level: {0}", primaryThread.Priority);      
    Console.WriteLine("Thread State: {0}", primaryThread.ThreadState);
  }
}
Thread Name: ThePrimaryThread
Alive: True
Priority Level: Normal
Thread State: Running








20.11.Current Thread
20.11.1.CurrentThread: Name, ApartmentState, IsAlive, Priority, ThreadState
20.11.2.Current Thread HashCode
20.11.3.Context Manipulator