Array.LastIndexOf
using System;
class MainClass
{
public static void Main()
{
int[] intArray = {1, 2, 1, 3};
Console.WriteLine("intArray:");
for (int i = 0; i < intArray.Length; i++)
{
Console.WriteLine("intArray[" + i + "] = " +
intArray[i]);
}
int index = Array.IndexOf(intArray, 1);
Console.WriteLine("Array.IndexOf(intArray, 1) = " + index);
index = Array.LastIndexOf(intArray, 1);
Console.WriteLine("Array.LastIndexOf(intArray, 1) = " + index);
}
}
Related examples in the same category