List : Exists
//Exists Method
//using System;
//using System.Collections.Generic;
class Program
{
static void Main()
{
List<int> list = new List<int>();
list.Add(7);
list.Add(11);
list.Add(13);
//Test whether any elements with values greater than
//10 exist.
//explicitly typing a bool var, 'exists'
bool exists = list.Exists(element => element < 10);
Console.WriteLine(exists);
//Checking whether there are numbers less than 7
exists = list.Exists(element => element < 7);
Console.WriteLine(exists);
}
}
/*
Output
True
False
*/