日期:2014-05-18 浏览次数:20819 次
    class MySort<T> where T : IComparable                                     //<---
    {
        public void InsertSort(T[] a)
        {
            T t;
            int j;
            for (int i = 1; i < a.Length; i++)
            {
                t = a[i];
                for (j = i; j > 0 && a[j - 1].CompareTo(t) > 0; j--)           //<---
                    a[j] = a[j - 1];
                a[j] = t;
            }
        }
    }