linq.Where

Filters a sequence of values based on a predicate.

Overloads

  • Array Where (predicate)

Array Where (predicate)

Filters a sequence of values based on a predicate.
Note: If predicate takes a second parameter, the index of the current element is passed in it
var myArray = [1, 2, 3, 4];
//Returns [1, 2]
myArray.Where("o => o < 3");

myArray = [1, 3, 2, 4];
//Returns [1, 4]
myArray.Where("(o, i) => o == (i + 1)");

Last edited Sep 24, 2011 at 8:50 AM by mlorbetske, version 1

Comments

No comments yet.