var threads = new List<Thread>();foreach (Foo f in ListOfFoo){ Thread thread = new Thread(() => f.DoSomething()); threads.Add(thread); thread.Start();}
-
var threads = new List<Thread>();foreach (Foo f in ListOfFoo){ Foo f2 = f; Thread thread = new Thread(() => f2.DoSomething()); threads.Add(thread); thread.Start();}
最新情况:
foreach标识符和闭包
慕桂英3389331
胡说叔叔