Mega Code Archive

 
Categories / C# Book / 04 LINQ
 

0492 Any - Simple

public void Linq67() { string[] words = { "believe", "relief", "receipt", "field" }; bool iAfterE = words.Any(w => w.Contains("ei")); Console.WriteLine("There is a word that contains in the list that contains 'ei': {0}", iAfterE); } Result There is a word that contains in the list that contains 'ei': True