linq.Zip

Merges two sequences by using the specified function.

Overloads

  • Array Zip (array, function)

Array Zip (array, function)

Merges two sequences by using the specified function.
Note: Zip operates on the set until one or both operands are depleted, meaning that the shorter array determines the size of the output.
Also Note: The function parameter, in this case, is used to construct the output as a combination of its two operands
var myArray = [1, 2, 3, 4];
var myOtherArray = [{x: 2}, {x: 6}, {x: 1}];
//Returns [{x:2, y: 1}, {x: 6, y: 2}, {x: 1, y: 3}]
myArray.Zip(myOtherArray, "(a, b) => { return {x: b.x, y: a}; }");

Last edited Sep 24, 2011 at 9:01 AM by mlorbetske, version 4

Comments

No comments yet.