diff --git a/Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs b/Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs index e2065c7..c8f1303 100644 --- a/Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs +++ b/Lab1ContainersShip/Lab1ContainersShip/FormShipCollection.cs @@ -53,7 +53,7 @@ MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; } int pos = Convert.ToInt32(maskedTextBoxNumber.Text); - if (_ships - pos != null) + if (!(_ships - pos)) { MessageBox.Show("Объект удален"); pictureBoxCollection.Image = _ships.ShowShips(); diff --git a/Lab1ContainersShip/Lab1ContainersShip/ShipGenericCollection.cs b/Lab1ContainersShip/Lab1ContainersShip/ShipGenericCollection.cs index 4c7bfed..c8272cd 100644 --- a/Lab1ContainersShip/Lab1ContainersShip/ShipGenericCollection.cs +++ b/Lab1ContainersShip/Lab1ContainersShip/ShipGenericCollection.cs @@ -67,15 +67,15 @@ namespace Lab1ContainersShip /// /// /// - public static T operator -(ShipGenericCollection collect, int + public static bool operator -(ShipGenericCollection collect, int pos) { T obj = collect._collection.Get(pos); if (obj != null) { - collect._collection.Remove(pos); + return collect._collection.Remove(pos); } - return obj; + return false; } /// /// Получение объекта IMoveableObject