Here is the sample code.
var values = new List<string>() { "Stack", "Over", "Go" };
var funcs = new List<Func<string>>();
foreach(var v in values)
funcs.Add( ()=>v );
foreach(var f in funcs)
Console.WriteLine(f());
When I ran this code with visual studio 2010 I got the output as:
Go Go Go
But when I tried the same code in visual studio 2012 the output was:
Stack Over Go
Why is it behaving differently?