/* 线程,任务,同步之Thread */ using System; using System.Threading; using System.Diagnostics; namespace Frank { public class Test { //程序入口 public static void Main(string[] args) { //Thread t1 = new Thread(ThreadMethod); Thread t1 = new Thread(()=>{Console.WriteLine("2");});//使用Lambda表达式 t1.Start(); Thread t2 = new Thread(ThreadMainWithParameters);//带参数的线程,无返回值,必须有一个是object的参数 t2.Start(1); } static void ThreadMethod() { Console.WriteLine("1"); } static void ThreadMainWithParameters(object o) { Console.WriteLine(o); } } }