Zip C# with Example
The Zip extension method acts upon two collections. It pairs each element in the two series together based on position. With a Func instance, we use Zip to handle elements from the two C# collections in pairs. If the series differ in size, the extra elements of the larger series will be ignored. To take an example from the book "C# in a Nutshell", int[] numbers = { 3, 5, 7 }; string[] words = { "three", "five", "seven", "ignored" }; IEnumerable zip = numbers.Zip(words, (n, w) => n + "=" + w); Output: 3=three 5=five 7=seven View Demo