Home > Article > Backend Development > What is the difference between All and Any in C# Linq?
Any( The above is the detailed content of What is the difference between All and Any in C# Linq?. For more information, please follow other related articles on the PHP Chinese website!Output
False
True
Example
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();
}
Output if at least one element in the source sequence matches the supplied predicate
True
False