Malin D.V. Lab work 4 #4

Merged
eegov merged 6 commits from LabWork_04 into LabWork_03 2022-10-21 08:46:37 +04:00
Showing only changes of commit 80c18de5db - Show all commits

View File

@ -34,12 +34,7 @@ namespace WarmlyLocomotive
/// <returns></returns>
public int Insert(T locomotive)
{
if (_maxCount == Count)
{
return -1;
}
_places.Insert(0, locomotive);
return 0;
return Insert(locomotive, 0);
}
/// <summary>
/// Добавление объекта в набор на конкретную позицию
@ -49,7 +44,7 @@ namespace WarmlyLocomotive
/// <returns></returns>
public int Insert(T locomotive, int position)
{
if (position < 0 || position >= Count || _maxCount == Count)
if (position < 0 || position > Count || _maxCount == Count)
{
return -1;
}