In the following example, we search an array of strings for a name containing the letter "a":
string[] names = { "jack", "asdf", "book2s.com" }; string match = Array.Find (names, n => n.Contains ("a")); // Jack
Array.FindAll returns an array of all items satisfying the predicate.
It's equivalent to Enumerable.Where in the System.Linq namespace.
Array.FindAll returns an array of matching items.
Array.Exists returns true if any array member satisfies the given predicate, and is equivalent to Any in System.Linq.Enumerable.
Array.TrueForAll returns true if all items satisfy the predicate, and is equivalent to All in System.Linq.Enumerable.
using System; class MainClass/*from w w w . j a v a 2 s . co m*/ { public static void Main(string[] args) { string[] names = { "jack", "asdf", "book2s.com" }; string match = Array.Find (names, n => n.Contains ("a")); Console.WriteLine(match); } }