linq.Any

Returns whether at least one of the elements is true (or defined)

Overloads

  • bool Any ()
  • bool Any (condition)

bool Any ()

Returns whether at least one of the elements in the set are true (or defined)

Example

var myArray = [true, false];
//Returns true
myArray.Any();

myArray[0] = false;
//Returns false
myArray.Any();

myArray[0] = null;
//Returns false
myArray.Any();

bool Any (condition)

Returns whether at least one of the elements in the set satisfy the specified condition

Example

var myArray = [1, 2, 3];
//Returns true because at least one of the elements are odd
myArray.Any("x => x % 2 == 1");

//Returns true because all the elements are positive
myArray.Any("x => x > 0");

Last edited Sep 23, 2011 at 3:46 AM by mlorbetske, version 4

Comments

No comments yet.