Are local variables threadsafe?
问题 I have a class like the one below: class Program { static void Main(string[] args) { var outputWindow = new OutputWindow(); var threads = new List<Thread>(); Action action = () => outputWindow.Display(20); for (int i = 0; i < 10; i++) { var thread = new Thread(() => action()) {Name = "Thread " + i}; threads.Add(thread); } foreach (var thread in threads) { thread.Start(); } } } public class OutputWindow { public void Display(int x) { for (int i = 0; i < x; i++) { Console.WriteLine(Thread