Polevoy S.V Lab_work7 #7

Closed
ChipsEater wants to merge 9 commits from LabWork07 into LabWork06
Showing only changes of commit eb4416e7ed - Show all commits

View File

@ -26,7 +26,12 @@ namespace Artilleries
public int Insert(T artillery, int position)
{
if (position < 0 || position > Count || Count == _maxCount)
if (Count == _maxCount)
{
throw new StorageOverflowException(_maxCount);
}
if (position < 0 || position > Count)
{
return -1;
}
@ -45,6 +50,11 @@ namespace Artilleries
var result = _places[position];
if (result == null)
{
throw new ArtilleryNotFoundException(position);
}
_places.RemoveAt(position);
return result;
}