Find string in an Array (C#)

September 06, 2013 // In: C#

You can find string in an array using two methods. (I know there are plenty of methods, but two methods are most common)

find string in an array

Method 1

You can loop each item of an array and compare each item of the array with the items that are to find. If match found it return true otherwise it returns false.

 Method 2

Array.IndexOf is used to find items in an array.

According to MSDN, Array.IndexOf returns the index of the first occurrence of a value in a one-dimensional Array or in a portion of the Array.

 

Create DataTable From SQL Query in C#
Validate TextBox For Digits, Alphabets, AlphaNumeric Characters