Current Thread HashCode : Current Thread « Thread « C# / CSharp Tutorial






using System;
using System.Threading;

public class MainClass
{
    private static void ThreadFunc() {
        Console.WriteLine( "Thread.CurrentThread.GetHashCode() {0}!",Thread.CurrentThread.GetHashCode() );
    }
    
    static void Main() {
        Thread newThread = new Thread( new ThreadStart(ThreadFunc) );
        Console.WriteLine( "Main Thread is {0}", Thread.CurrentThread.GetHashCode() );
        
        newThread.Start();
        newThread.Join();
        
        Thread.Sleep(2000);
    }
}
Main Thread is 1
Thread.CurrentThread.GetHashCode() 3!








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