using System; using System.Threading; class Program { static void Main(string[] args) { Thread thread1 = new Thread(new ThreadStart(method)); thread1.Start(); Thread thread2 = new Thread(delegate() { Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "通过匿名委托创建线程"); }); thread2.Start(); Thread thread3 = new Thread(()=> Console.WriteLine(Thread.CurrentThread.ManagedThreadId + "通过lambda表达式创建线程")); thread3.Start(); Thread thread4 = new Thread(new ParameterizedThreadStart(method2)); thread4.Start("通过有参委托创建线程"); } static void method() { Console.WriteLine(Thread.CurrentThread.ManagedThreadId+ "通过无参【静态】方法创建线程"); } static void method2(object obj)//参数必须是obj,后面再向下转 { string s = Thread.CurrentThread.ManagedThreadId + (string)obj; Console.WriteLine(s); } }