예제 #1
0
            int IComparer.Compare(object a, object b)
            {
                car c1 = (car)a;
                car c2 = (car)b;

                return(String.Compare(c2.make, c1.make));
            }
예제 #2
0
            int IComparer.Compare(object a, object b)
            {
                car c1 = (car)a;
                car c2 = (car)b;

                if (c1.year < c2.year)
                {
                    return(1);
                }

                if (c1.year > c2.year)
                {
                    return(-1);
                }

                else
                {
                    return(0);
                }
            }
예제 #3
0
        // Implement IComparable CompareTo to provide default sort order.
        int IComparable.CompareTo(object obj)
        {
            car c = (car)obj;

            return(String.Compare(this.make, c.make));
        }