I am trying to understand why this program doesn\'t work
Expected output: numbers 0-19 in random order What I get when I run: some numbers repeat, sometimes 20 is pr
public void processinThreads() { for (int i = 0; i < 20; i++) { int local = i; Thread t = new Thread(new ThreadStart(()=>DoSomething(local, processCallback))); t.Start(); } }
Your problem is related to closure over lambda.