17:static IEnumerable<int> Calculate(int min, int max)
19:for (var i = min; i < max; i++)
21: Console.WriteLine("calculated: " + i);
And the result:
As we see, .NET remembers the position in the foreach loop within the ‘Calculate’-method. Does anyone know when this pointer will be cleaned by the garbage collector? Most likely when the variable ‘numbers’ gets collected, right?