To search any element in array we use Contains Function. This function is declared and defined in Array class. We have to pass the value in this method. If this value available in the given array then it will return true and if not then it will return false.
Suppose we have following array. And I want to search the value 50 in this array. Then I will use the function in following manner
int[] data = new int[5];
data[0] = 100;
data[1] = 50;
data[2] = 209;
data[3] = 1000;
data[4] = 789;
//Searching in Array
bool result = data.Contains(50);
if (result)
{
Response.Write("Value exist");
}
else
{
Response.Write("Value not Exist");
}
It will simply return me the message Value exist.
For any query you can send mail at info@techaltum.com
Thanks