int IComparer.Compare(object a, object b) { car c1 = (car)a; car c2 = (car)b; return(String.Compare(c2.make, c1.make)); }
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); } }
// Implement IComparable CompareTo to provide default sort order. int IComparable.CompareTo(object obj) { car c = (car)obj; return(String.Compare(this.make, c.make)); }