static void Main() { BackgroundTest shortTest = new BackgroundTest(10); Thread foregroundThread = new Thread(new ThreadStart(shortTest.RunLoop)); BackgroundTest longTest = new BackgroundTest(50); Thread backgroundThread = new Thread(new ThreadStart(longTest.RunLoop)); backgroundThread.IsBackground = true; foregroundThread.Start(); backgroundThread.Start(); }
static void Main(string[] args) { BackgroundTest shortTest = new BackgroundTest(11); Thread foregroundThread = new Thread(new ThreadStart(shortTest.RunLoop)); foregroundThread.Name = "foregroundThread"; foregroundThread.Start(); BackgroundTest longTest = new BackgroundTest(100); Thread backgroundThread = new Thread(new ThreadStart(longTest.RunLoop)); backgroundThread.Name = "backgroundThread"; backgroundThread.IsBackground = true; backgroundThread.Start(); for (int i = 0; i < 100; i++) { Console.WriteLine("Hi From Main Method"); } //Console.ReadLine(); }