Find why every callback prints the same value after the loop.
csharp
using System;
using System.Collections.Generic;
var callbacks = new List<Action>();
for (int i = 0; i < 3; i++)
callbacks.Add(() => Console.WriteLine(i));
foreach (Action callback in callbacks)
callback();