public int CompareTo(Term other) { if (Type == other.Type) { switch (Type) { case TermType.Symbol: return(((Symbol)this).CompareTo((Symbol)other)); case TermType.Function: return(((Function)this).CompareTo((Function)other)); case TermType.TermList: return(((TermList)this).CompareTo((TermList)other)); } } return(Type.CompareTo(other.Type)); }