Готовая 7 лаба

This commit is contained in:
platoff aeeee 2023-12-25 10:47:13 +04:00
parent 5c23c80066
commit e447b0db60

View File

@ -40,8 +40,8 @@ namespace Tank.Generics
public bool Remove(int position)
{
if (position < 0 || position > _maxCount)
return false;
if (position < 0 || position > _maxCount || position >= Count)
throw new TankNotFoundException(position);
_places.RemoveAt(position);
return true;
}
@ -49,15 +49,13 @@ namespace Tank.Generics
{
get
{
if (position < 0 || position > _maxCount)
{
if(position < 0 || position >= Count)
return null;
}
return _places[position];
}
set
{
if (position < 0 || position > _maxCount)
if (position < 0 || position > _maxCount || Count == _maxCount)
{
return;
}