Any(
예
static void Main(string[] args){ IEnumerable<double> doubles = new List<double> { 1.2, 1.7, 2.5, 2.4 }; bool result = doubles.Any(val => val < 1); System.Console.WriteLine(result); IEnumerable<double> doubles1 = new List<double> { 0.8, 1.7, 2.5, 2.4 }; bool result1 = doubles1.Any(val => val < 1); System.Console.WriteLine(result1); Console.ReadLine(); }
출력
False True
예
static void Main(string[] args){ IEnumerable<double> doubles = new List<double> { 0.8, 0.9, 0.6, 0.7 }; bool result = doubles.All(val => val < 1); System.Console.WriteLine(result); IEnumerable<double> doubles1 = new List<double> { 0.8, 0.9, 1.0, 0.7 }; bool result1 = doubles1.All(val => val < 1); System.Console.WriteLine(result1); Console.ReadLine(); }
출력
True False