Any Operator
The Any operator checks whether any element of a sequence satisfies a condition.
This sample determines whether any words in a string array contain the character sequence 'ei'. It uses Any, passing a lambda expression that uses the Contains method to perform the check.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
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);
Console.ReadLine();
}
}
}
Output:
Aspnet Discussion
- - Web application
- - Great Indian Developer Su
- - Aspx page inside Silverli
- - Open aspx page inside Sil
- - Guidance for a novice





