linq.Select

Selects elements from an array

Overloads

  • Array Select (selector)

Array select (selector)

Selects elements from an array
Note: If two parameters are provided on the selector function, the second one will be passed the index of the current item

Example

var myArray = [{x: 1}, {x: 2}, {x: 3}, {x: 4}, {x: 4}, {x: 4}, {x: 5}];
//Returns [1, 2, 3, 4, 4, 4, 5]
myArray.Select("o => o.x");

//Returns [1, 3, 5, 7, 8, 9, 11]
myArray.Select("(o, i) => o.x + i");

Last edited Sep 24, 2011 at 5:38 AM by mlorbetske, version 3

Comments

No comments yet.