static void Main(string[] args) { int i = 0; Parallel.For(0, 100, (x) => { Console.WriteLine(i); i++; }); Console.WriteLine($"i is {i}"); Console.ReadLine(); }