PIbd-21 Potapov N.S. LabWork07 #7
@ -71,17 +71,17 @@ namespace ProjectStormtrooper
|
||||
public T? Remove(int position)
|
||||
{
|
||||
// Проверка позиции
|
||||
if (position < 0 || position >= Count)
|
||||
if (position < 0 || position >= _maxCount)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
// Удаление объекта из массива, присвоив элементу массива значение null
|
||||
T? plane = _places[position];
|
||||
if (plane == null)
|
||||
if (position >= Count && position < _maxCount)
|
||||
{
|
||||
throw new PlaneNotFoundException(position);
|
||||
}
|
||||
_places[position] = null;
|
||||
// Удаление объекта из массива, присвоив элементу массива значение null
|
||||
T? plane = _places[position];
|
||||
_places.RemoveAt(position);
|
||||
return plane;
|
||||
}
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user