Search for object and returns the index within sub range of Array in CSharp
Description
The following code shows how to search for object and returns the index within sub range of Array.
Example
// w ww . j ava 2 s . c om
using System;
public class Example
{
public static void Main()
{
string[] myValues = { "2001",
"1999",
"2000",
"1234",
"2002",
"2001",
"4567" };
Console.WriteLine(Array.IndexOf(myValues, "2001", 2, 2));
}
}
The code above generates the following result.