using System.Collections.Generic;
public static void Main()
var l = new int[] { 9, 1, 3, 8, 4, 6 };
Console.WriteLine("6 is the " + l.Rank(6) + "th element of ");
Console.WriteLine(String.Join(" ", l));
public static class ExtensionMethods
public static int Rank<T>(this IEnumerable<T> list, T item) where T : IComparable
return list.Count(x => x.CompareTo(item) < 0) + 1;