Исправлен insert

This commit is contained in:
Danil Malin 2022-10-18 20:30:54 +04:00
parent 56b0d0de6f
commit 80c18de5db

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;
}