Current Thread HashCode : Current Thread : Thread C# Examples


C# Examples » Thread » Current Thread »

 

Current Thread HashCode









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



Output

Main Thread is 1
Thread.CurrentThread.GetHashCode() 3!


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Thread
» Current Thread