public int CompareTo(ClassArray <T> other) { if (this.Count() > other.Count()) { return(-1); } else if (this.Count() < other.Count()) { return(1); } else { var thisKeys = this.places.Keys.ToList(); var otherKeys = other.places.Keys.ToList(); for (int i = 0; i < this.places.Count; ++i) { if (this.places[thisKeys[i]] is MotorShip && other.places[otherKeys[i]] is UltaMegaBuffSuperMotorShip) { return(1); } if (this.places[thisKeys[i]] is UltaMegaBuffSuperMotorShip && other.places[otherKeys[i]] is MotorShip) { return(-1); } if (this.places[thisKeys[i]] is MotorShip && other.places[otherKeys[i]] is MotorShip) { return((this.places[thisKeys[i]] is MotorShip) .CompareTo(other.places[otherKeys[i]] is MotorShip)); } if (this.places[thisKeys[i]] is UltaMegaBuffSuperMotorShip && other.places[otherKeys[i]] is UltaMegaBuffSuperMotorShip) { return((this.places[thisKeys[i]] is UltaMegaBuffSuperMotorShip) .CompareTo(other.places[otherKeys[i]] is UltaMegaBuffSuperMotorShip)); } } } return(0); }