Class Program {static void Main (string[] args) {/* background thread * As long as one foreground thread is running, the application is running * Multiple foreground threads running, the Main () method ends and the application process is activated until the foreground thread finishes As a task * Default: Thread class creates threads that are foreground threads, and thread pools are background threads/thread T1 = new Thread (ThreadMain); T1. Name = "66"; Set to foreground thread T1. IsBackground = false; T1. Start (); Console.WriteLine ("Main thread end.") "); /* Run to see although the main thread main () method has finished exiting * But the entire program still continues to run until the T1 thread (foreground thread) is created to exit the program * if set T1. IsBackground = True to create a background thread, the main thread main () method ends * The entire program exits regardless of whether the created T1 thread (background thread) is running to completion/} static void ThreadMain () {Console.writel INE ("thread start" + Thread.CurrentThread.Name); Thread.Sleep (5000); Console.WriteLine ("Thread complete.") "+ Thread.CurrentThread.Name);}}