From e8a4f802def8f17a73ff44366d8e85f8a2c0efcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=88=D0=B8=D0=BD=20=D0=9C=D0=B0=D0=BA=D1=81?= =?UTF-8?q?=D0=B8=D0=BC?= Date: Thu, 1 Dec 2022 23:43:38 +0400 Subject: [PATCH] fix --- .../GasolineTanker/SetGasolineTankerGeneric.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) 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))