изменил вставку

This commit is contained in:
zum 2024-03-21 19:09:59 +04:00
parent e5df4eb3e6
commit 8ae53d9903

View File

@ -54,12 +54,11 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
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;
}