search for element in array c# code example
Example 1: c# search string array
string [] arr = {"One","Two","Three"};
var target = "One";
var results = Array.FindAll(arr, s => s.Equals(target));
Example 2: find items in array c#
string[] names = { "Steve", "Bill", "Bill Gates", "Ravi", "Mohan", "Salman", "Boski" };
var stringToFind = "Bill";
var result = Array.Find(names, element => element == stringToFind); // returns "Bill"