From 9bb3eb73a44ceec656374942f14bc7e80f2db10e Mon Sep 17 00:00:00 2001 From: "ns.potapov" Date: Mon, 20 Nov 2023 21:26:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=20=D0=B1=D0=B0=D0=B3?= =?UTF-8?q?=D0=B0=20=D1=81=20=D1=83=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectStormtrooper/ProjectStormtrooper/SetGeneric.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ProjectStormtrooper/ProjectStormtrooper/SetGeneric.cs b/ProjectStormtrooper/ProjectStormtrooper/SetGeneric.cs index f2c2d7f..6245de1 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/SetGeneric.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/SetGeneric.cs @@ -71,17 +71,17 @@ namespace ProjectStormtrooper public T? Remove(int position) { // Проверка позиции - if (position < 0 || position >= Count) + if (position < 0 || position >= _maxCount) { return null; } - // Удаление объекта из массива, присвоив элементу массива значение null - T? plane = _places[position]; - if (plane == null) + if (position >= Count && position < _maxCount) { throw new PlaneNotFoundException(position); } - _places[position] = null; + // Удаление объекта из массива, присвоив элементу массива значение null + T? plane = _places[position]; + _places.RemoveAt(position); return plane; } ///