From 9d782d7465d64224fd5c46a21bc8e8353128ed41 Mon Sep 17 00:00:00 2001 From: MorozovDanil Date: Mon, 15 Apr 2024 01:48:53 +0400 Subject: [PATCH] =?UTF-8?q?=D1=82=D0=B8=D0=BF=D1=8B=20=D0=BF=D0=BE=D0=BF?= =?UTF-8?q?=D1=80=D0=B0=D0=B2=D0=B8=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MassiveGenericObjects.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ProjectContainerShip/ProjectContainerShip/CollectionGenericObjects/MassiveGenericObjects.cs b/ProjectContainerShip/ProjectContainerShip/CollectionGenericObjects/MassiveGenericObjects.cs index 13f4640..01743cf 100644 --- a/ProjectContainerShip/ProjectContainerShip/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/ProjectContainerShip/ProjectContainerShip/CollectionGenericObjects/MassiveGenericObjects.cs @@ -50,21 +50,21 @@ public class MassiveGenericObjects : ICollectionGenericObjects return null; } - public bool Insert(T obj) + public int Insert(T obj) { return Insert(obj, 0); } - public bool Insert(T obj, int position) + public int Insert(T obj, int position) { if (position < 0 || position >= Count) { - return false; + return -1; } if (_collection[position] == null) { _collection[position] = obj; - return true; + return position; } for (int i = position + 1; i < Count; i++) @@ -72,7 +72,7 @@ public class MassiveGenericObjects : ICollectionGenericObjects if (_collection[i] == null) { _collection[i] = obj; - return true; + return i; } } for (int i = position - 1; i >= 0; i--) @@ -80,21 +80,21 @@ public class MassiveGenericObjects : ICollectionGenericObjects if (_collection[i] == null) { _collection[i] = obj; - return true; + return i; } } - return false; + return -1; } - public bool Remove(int position) + public T Remove(int position) { if (position < 0 || position >= Count) { - return false; + return null; } T obj = _collection[position]; _collection[position] = null; - return true; + return obj; } } \ No newline at end of file