using System.Diagnostics;
public static void Main()
var stopwatch = Stopwatch.StartNew();
var elements = Enumerable.Range(1, count).Select(i => (i, $"Item #{i}")).ToArray();
var elements2 = Enumerable.Range(1, count).Select(i => (i, $"SECRETS #{i}")).Reverse().ToArray();
Console.WriteLine($"{stopwatch.Elapsed} to generate collection");
stopwatch = Stopwatch.StartNew();
var found1 = elements.Select(e => elements2.FirstOrDefault(x => x.Item1 == e.Item1));
Console.WriteLine($"{stopwatch.Elapsed} to find with FirstOrDefault");
stopwatch = Stopwatch.StartNew();
var dictionary = elements2.ToDictionary(e => e.Item1, e => e.Item2);
Console.WriteLine($"{stopwatch.Elapsed} to build dictionary");
stopwatch = Stopwatch.StartNew();
var found2 = elements.Select(e => dictionary[e.Item1]);
Console.WriteLine($"{stopwatch.Elapsed} to find with dictionary indexing");
stopwatch = Stopwatch.StartNew();
join e2 in elements2 on e.Item1 equals e2.Item1 into grouped
select (e.Item1, grouped.FirstOrDefault());
Console.WriteLine($"{stopwatch.Elapsed} with query");
Console.WriteLine(found3.Count());
Console.WriteLine(found3.FirstOrDefault());