Sobes.tech
Junior — Senior

What result will a LINQ query with side effects and deferred execution display

livecode

Task condition

What text will be printed in the console? What value will the variable counter have after executing the code?

using static System.Console;

int counter = 0;
var data = Enumerable.Range(0, 5)
    .Select(index =>
     {
         counter++;
         return index;
     });

WriteLine(data.Count());
WriteLine(data.Max());
WriteLine(data.Min());
WriteLine(counter);