From 8ae53d9903bc8ac112cec4f0ade94d7ea11817b5 Mon Sep 17 00:00:00 2001 From: zum Date: Thu, 21 Mar 2024 19:09:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D1=81=D1=82=D0=B0=D0=B2=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CollectionGenericObjects/MassiveGenericObjects.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ProjectStormTrooper/ProjectStormTrooper/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectStormTrooper/ProjectStormTrooper/CollectionGenericObjects/MassiveGenericObjects.cs index e533580..e957d1b 100644 --- a/ProjectStormTrooper/ProjectStormTrooper/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectStormTrooper/ProjectStormTrooper/CollectionGenericObjects/MassiveGenericObjects.cs @@ -54,12 +54,11 @@ public class MassiveGenericObjects : ICollectionGenericObjects public bool Insert(T obj) { - for (int i = 0; i < _collection.Length; i++) + int index = Array.IndexOf(_collection, null); + if(index >= 0) { - if (_collection[i] == null) { - _collection[i] = obj; - return true; - } + _collection[index] = obj; + return true; } return false; }