Any - Simple

Query
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);
}
Lambda Expression
public void Linq67()
{
string[] words = { "believe", "relief", "receipt", "field" };

bool iAfterE = words.Any(w => w.Contains("ei"));

//DONE fixed typo in writeline
Console.WriteLine("There is a word in the list that contains 'ei': {0}", iAfterE);
}
Output
There is a word that contains in the list that contains 'ei': True
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +