diff --git a/GasolineTanker/GasolineTanker/SetGasolineTankerGeneric.cs b/GasolineTanker/GasolineTanker/SetGasolineTankerGeneric.cs index e12d64b..c782a6a 100644 --- a/GasolineTanker/GasolineTanker/SetGasolineTankerGeneric.cs +++ b/GasolineTanker/GasolineTanker/SetGasolineTankerGeneric.cs @@ -19,15 +19,7 @@ namespace GasolineTanker } public int Insert(T gasolineTanker) { - if (_places.Count < _maxCount) - { - _places.Add(gasolineTanker); - for (int i = 0; i < _places.Count; i++) - { - if (_places[i] == gasolineTanker) return i; - } - } - return -1; + return Insert(gasolineTanker, 0); } private bool isCorrectPosition(int position) { @@ -36,7 +28,7 @@ namespace GasolineTanker public int Insert(T gasolineTanker, int position) { if (_places.Contains(gasolineTanker)) - throw new ArgumentException($"Объект {gasolineTanker} уже есть в наборе"); + throw new ArgumentException($"The {gasolineTanker} object is already in the set"); if (Count == _maxCount) throw new StorageOverflowException(_maxCount); if (!isCorrectPosition(position))