linq.All

Returns whether all the elements are true (or defined)

Overloads

  • bool All ()
  • bool All (condition)

bool All ()

Returns whether all the elements in the set are true (or defined)

Example

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

myArray[1] = true;
//Returns true
myArray.All();

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

bool All (condition)

Returns whether all the elements in the set satisfy the specified condition

Example

var myArray = [1, 2, 3];
//Returns false because not all the elements are odd
myArray.All("x => x % 2 == 1");

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

Last edited Sep 24, 2011 at 2:58 AM by mlorbetske, version 7

Comments

No comments yet.