Finding Index


using System;

// IndexOf is a method in Array class used to find the index of a particular element
class ArrayIndex
{    
    static void Main(string[] args)
    {
        int[] intArray = new int[5] { 1048315 };

        Console.WriteLine("Elements of array: ");
        foreach (int i in intArray)
        {
            Console.WriteLine(i);
        }

        int index = Array.IndexOf(intArray, 4);     // Returns the index of '4' in intArray
        Console.WriteLine("index: " + index);

        Console.ReadLine();

    }
}

Output:
Elements of array:
10
4
8
3
15
index: 1