Use LINQ to “Zip” collections together
Richard
December 06, 2012
.NET, Development, LINQ
Comments Off on Use LINQ to “Zip” collections together
Tags: .NET 4.0, IEnumerable, LINQ, ZIP
The Zip method pairs together the items in 2 Enumerable collections into 1 single collection that can be used to enumerate through the paired items . Each pair of items can then be operated on to produce a final collection. Put simply, the item at index 1 in my “Zipped” collection contains the items at index 1 from the original 2 collections. The Zip stops when one of the source collections runs out of items (since Zip cant make any more pairs of items).
Zip takes the two collections to index through and a function to apply on each index … Continue Reading