public int CompareTo(object obj) { AbstractFigure figure = obj as AbstractFigure; if (GetArea() > figure.GetArea()) { return(1); } else if (figure.GetArea() > GetArea()) { return(-1); } else { return(0); } }
public int Compare(object obj1, object obj2) { AbstractFigure figure1 = obj1 as AbstractFigure; AbstractFigure figure2 = obj2 as AbstractFigure; if (figure2.GetArea() > figure2.GetArea()) { return(1); } else if (figure1.GetArea() > figure2.GetArea()) { return(-1); } else { return(0); } }