using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; namespace ThreadDemo { class Program { static void Main(string[] args) { ThreadStart ts = new ThreadStart(count); Thread td = new Thread(ts); td.Name = "子线程运行"; td.Start(); Thread.CurrentThread.Name = "现在执行的主线程"; count(); Console.ReadKey(); } private static void count() { for (int i = 0; i <= 1000; i++) { Console.WriteLine("{0}:{1}", Thread.CurrentThread.Name, i);//Thread.CurrentThread.Name是谁去调用的线程名字 Thread.Sleep(1);//暂时停止使用CPU } } } } 运行效果: