简单的数组排序

     int[] a = new int[] { 2, 1, 3, 6, 8, 7 };
            Array.Sort(a,new CompareAge());
            foreach (int temp in a)
            {
                Response.Write(temp.ToString()+"<br>");
            }
    public class CompareAge:IComparer
    {
        int IComparer.Compare(object a,object b)
        {
            int i = 0,j = 0;
            int.TryParse(a.ToString(),out i);
            int.TryParse(b.ToString(),out j);
            return i -j;
        }
    }
原文地址:https://www.cnblogs.com/bestsaler/p/1835593.html