изменения

This commit is contained in:
AnnaLioness 2023-10-20 17:36:21 +04:00
parent 974fa03ade
commit 319fa1298d
2 changed files with 4 additions and 4 deletions

View File

@ -53,7 +53,7 @@ MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
return; return;
} }
int pos = Convert.ToInt32(maskedTextBoxNumber.Text); int pos = Convert.ToInt32(maskedTextBoxNumber.Text);
if (_ships - pos != null) if (!(_ships - pos))
{ {
MessageBox.Show("Объект удален"); MessageBox.Show("Объект удален");
pictureBoxCollection.Image = _ships.ShowShips(); pictureBoxCollection.Image = _ships.ShowShips();

View File

@ -67,15 +67,15 @@ namespace Lab1ContainersShip
/// <param name="collect"></param> /// <param name="collect"></param>
/// <param name="pos"></param> /// <param name="pos"></param>
/// <returns></returns> /// <returns></returns>
public static T operator -(ShipGenericCollection<T, U> collect, int public static bool operator -(ShipGenericCollection<T, U> collect, int
pos) pos)
{ {
T obj = collect._collection.Get(pos); T obj = collect._collection.Get(pos);
if (obj != null) if (obj != null)
{ {
collect._collection.Remove(pos); return collect._collection.Remove(pos);
} }
return obj; return false;
} }
/// <summary> /// <summary>
/// Получение объекта IMoveableObject /// Получение объекта IMoveableObject