Quantifying

  • Any()

  • All()

  • Contains()

// Some code
IEnumerable<int> list = new List<int> { 2, 4, 6, 8, 10 };
//return true
var result1 = list.Any(x => x % 2 == 0);
//return true
var result2 = list.All(x => x % 2 == 0);
//return false
var result3 = list.Contains(5);

Last updated