Search for the specified object and returns the index of the last occurrence within the entire Array in CSharp
Description
The following code shows how to search for the specified object and returns the index of the last occurrence within the entire Array.
Example
/* www.j av a 2 s . co m*/
using System;
public class Example
{
public static void Main()
{
string[] myValues = { "2001",
"1999",
"2000",
"1234",
"2002",
"2001",
"3211" };
Console.WriteLine(Array.LastIndexOf(myValues, "2001"));
}
}
The code above generates the following result.