This project is read-only.


The zip linq operator returns a new linq object that contains the elements of the collection "zipped-up" with the elements of the "second" collection such that each value of the returned collection is a projection based upon the corresponding values of the originating and the second collections.

If the size of the originating collection and the second collection are not equal, then the size of the returned collection will equal the minimum of the two collections.
var arr1 = ['a', 'b', 'c', 'd', 'e'];
var arr2 = [1, 2, 3, 4, 5];

// col1 = ['a1', 'b2', 'c3', 'd4', 'e5']
var col1 = $linq(arr1).zip(arr2, "(x, y) => x + y").toArray();

// col2 = [{letter: 'a', number: 1}, {letter: 'b', number: 2}, {letter: 'c', number: 3}]
var col2 = $linq(arr1)
    .zip(arr2, "(x, y) => {letter: x, number: y}")

Last edited Sep 11, 2012 at 8:46 PM by battousai999, version 1