CSharp examples for System:Array Index
Index Of element in an array
using System.Runtime.InteropServices; using System.Collections.Generic; using System;//from w w w.j a va2s. c o m public class Main{ public static int IndexOf<T>(this T[] array, T item) { for (var i = 0; i < array.Length; ++i) { if (EqualityComparer<T>.Default.Equals(array[i], item)) { return i; } } return -1; } }