using System.Diagnostics;
public static void Main()
const int dataSize = 1_000_000;
var data = Enumerable.Range(0, dataSize).ToArray();
var stopwatch = Stopwatch.StartNew();
.Select(x => new { Value = x * 2 })
Console.WriteLine($"Anonymous type LINQ: {stopwatch.ElapsedMilliseconds} ms");
var everythingIsBetterWithArrays = new int[data.Count(x => x % 2 == 0)];
var anonToArrayResult = data
.Select(x => everythingIsBetterWithArrays[aIndex++] = x * 2 )
Console.WriteLine($"Anonymous to Array type LINQ: {stopwatch.ElapsedMilliseconds} ms");
var tempResult = new int[data.Count(x => x % 2 == 0)];
tempResult[index++] = x * 2;
Console.WriteLine($"Templated version: {stopwatch.ElapsedMilliseconds} ms");