public override bool Equals(System.Object otherCity) { if (!(otherCity is City)) { return(false); } else { City newCity = (City)otherCity; bool idEquality = this.GetId() == newCity.GetId(); bool nameEquality = this.GetName() == newCity.GetName(); return(idEquality && nameEquality); } }