.Net Tips – Use LINQ to create pairs of adjacent elements from a collection
Suppose you have an array of numbers, say, [1, 3, 5, 7, 9, …], and you want to pair each element up with its neighbour in the array, e.g. [[1, 3], [3, 5], [5, 7], [7, 9], …]. Sure, you can iterate through the indices of the elements and recursively grab the element at an …
.Net Tips – Use LINQ to create pairs of adjacent elements from a collection Read More »