Готовая 7 лаба
This commit is contained in:
parent
5c23c80066
commit
e447b0db60
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user