public int CompareTo(object obj) { if (obj == null) { return(1); } Carriage otherCarriage = obj as Carriage; if (otherCarriage != null) { return(this.Comfort.CompareTo(otherCarriage.Comfort)); } else { throw new ArgumentException("Обьект не является вагоном"); } }
public void ConnectCarriage(Carriage carriage) { CarriagesConnected.Add(carriage); }