Listnumbers = new List { 1, 2, 3, 4, 5 }; bool hasEvenNumber = numbers.Any(n => n % 2 == 0); // true
string[] words = { "apple", "beetle", "cat", "dog" }; bool hasLongWord = words.Any(w => w.Length >= 6); // trueIn this example, we use the Any function with a LINQ query to check if there is any word in an array of strings that has a length of 6 or more characters. Package library: This example requires the System.Linq namespace to be included.