How To : Start A Thread

Naimishforu
Posted by Naimishforu under C# category on | Points: 40 | Views : 2427
static void BackgroundThreadMethod()
{
Console.WriteLine("background thread started");
}
static void Main(string[] args)
{
//declare threadstart delegate
ThreadStart background = new ThreadStart(BackgroundThreadMethod);
Console.WriteLine("Creating background thread");
//start background thread
Thread t = new Thread(background);
t.Start();
Console.WriteLine("Starting background thread");
}

Comments or Responses

Login to post response