From 15553c9fddc3a76fdf3f484cb0811a8bcea6ef7a Mon Sep 17 00:00:00 2001 From: Programmist73 Date: Fri, 18 Nov 2022 12:42:27 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=B5=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D0=BE=20=D0=BD=D0=B5=D0=BA=D0=BE=D1=80?= =?UTF-8?q?=D1=80=D0=B5=D0=BA=D1=82=D0=BD=D0=BE=D0=BC=D1=83=20=D0=B8=D0=BD?= =?UTF-8?q?=D0=B4=D0=B5=D0=BA=D1=81=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Airbus/Airbus/SetPlanesGeneric.cs | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/Airbus/Airbus/SetPlanesGeneric.cs b/Airbus/Airbus/SetPlanesGeneric.cs index bdebdd9..744e88e 100644 --- a/Airbus/Airbus/SetPlanesGeneric.cs +++ b/Airbus/Airbus/SetPlanesGeneric.cs @@ -59,22 +59,15 @@ namespace Airbus //удаление объекта из набора с конкретной позиции public T Remove(int position) { - if (position < _maxCount && position >= 0) + if (position >= Count || position < 0) { - - if (_places.ElementAt(position) != null) - { - T result = _places.ElementAt(position); - - _places.RemoveAt(position); - - return result; - } - throw new PlaneNotFoundException(position); } - return null; + T result = _places[position]; + _places.RemoveAt(position); + + return result; } //получение объекта из набора по позиции