As we have seen in our last few posts on LINQ, the framework comes with some great extension methods to handle the merging of multiple collections into a single one.
However, there are things that LINQ can not easily do on its own. One of them is interweaving collections, i.e. merging them by taking elements from each input collection alternatively.
For example, given the inputs 1, 2, 3
and a, b, c
we would get the output 1, a, 2, b, 3, c
.
Today, we will look into how to best implement this ourselves.