Исправлено удаление
This commit is contained in:
parent
63b72d2531
commit
17c69aebd7
@ -82,7 +82,7 @@
|
||||
return;
|
||||
}
|
||||
int pos = Convert.ToInt32(maskedTextBoxPosition.Text);
|
||||
if (_mapAirplanesCollectionGeneric - pos == -1)
|
||||
if (_mapAirplanesCollectionGeneric - pos != null)
|
||||
{
|
||||
MessageBox.Show("Объект удален");
|
||||
pictureBox.Image = _mapAirplanesCollectionGeneric.ShowSet();
|
||||
|
@ -57,7 +57,7 @@ namespace AirBomber
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <param name="airplane"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>Возвращает позицию вставленого объекта либо -1, если не получилось его добавить</returns>
|
||||
public static int operator +(MapWithSetAirplanesGeneric<T, U> map, T airplane)
|
||||
{
|
||||
return map._setAirplanes.Insert(airplane);
|
||||
@ -67,8 +67,8 @@ namespace AirBomber
|
||||
/// </summary>
|
||||
/// <param name="map"></param>
|
||||
/// <param name="position"></param>
|
||||
/// <returns></returns>
|
||||
public static int operator -(MapWithSetAirplanesGeneric<T, U> map, int position)
|
||||
/// <returns>Возвращает удаленный объект, либо null если его не удалось удалить</returns>
|
||||
public static T operator -(MapWithSetAirplanesGeneric<T, U> map, int position)
|
||||
{
|
||||
return map._setAirplanes.Remove(position);
|
||||
}
|
||||
|
@ -73,13 +73,14 @@ namespace AirBomber
|
||||
/// Удаление объекта из набора с конкретной позиции
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <returns>Возвращает позицию вставленого объекта либо -1, если не получилось его добавить</returns>
|
||||
public int Remove(int position)
|
||||
/// <returns>Возвращает удаленный объект, либо null если его не удалось удалить</returns>
|
||||
public T Remove(int position)
|
||||
{
|
||||
if (!isCorrectPosition(position))
|
||||
return -1;
|
||||
return null;
|
||||
var result = _places[position];
|
||||
_places[position] = null;
|
||||
return position;
|
||||
return result;
|
||||
}
|
||||
/// <summary>
|
||||
/// Получение объекта из набора по позиции
|
||||
|
Loading…
Reference in New Issue
Block a user