Steps involved in Thread lifecycle


Here is the different steps involved in creating a new thread to run a thread.

Step 1: writes a class with some methods.
 
        Class TestingThread
        {
             Public static void SendMail()
             { 
               //Write the code to send mail
             }
        }

Step 2: Write  a ThreadStart delegate and point the address of SendMail. 

ThreadStart ts=new ThreadStart(TestingThread.SendMail()) 

Step 3: Create a thread

Thread t=new Thread(ts); 

Step 4: finally start the Threads.

t.Start();


Similar Articles