Simple Thread with ThreadStart : ThreadStart : Thread C# Examples


C# Examples » Thread » ThreadStart »

 

Simple Thread with ThreadStart









    
using  System;
using  System.Threading;

class  MainClass
{
    public  static  void  DoCount()
    {
        for  (  int  i  =  0;  i  <  10;  i++  )
        {
            System.Console.WriteLine(  "Reached  {0}",  i  );
        }
    }

    [STAThread]
    static  void  Main(string[]  args)
    {
        Thread  t  =  new  Thread(  new  ThreadStart(  DoCount  )  );
        t.Start();
    }
}
    
   
  
   



Output

Reached 0
Reached 1
Reached 2
Reached 3
Reached 4
Reached 5
Reached 6
Reached 7
Reached 8
Reached 9


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Thread
» ThreadStart