Доделаю

This commit is contained in:
sqdselo 2024-04-28 00:24:18 +04:00
parent 1cd23e10d7
commit 68f321a652

View File

@ -17,14 +17,21 @@ namespace HoistingCrane.CollectionGenericObjects
set
{
if (value > 0)
{
if (arr.Length > 0)
{
Array.Resize(ref arr, value);
}
else
{
arr = new T?[value];
}
}
}
}
public T? Get(int position)
{
if(position >= 0 && position < arr.Length)
if (position >= 0 && position < arr.Length)
{
return arr[position];
}
@ -32,16 +39,9 @@ namespace HoistingCrane.CollectionGenericObjects
}
public int Insert(T obj)
{
for (int i = 0; i < Count; i++)
{
if (arr[i] == null)
{
return Insert(obj, 0);
}
}
return -1;
}
public int Insert(T obj, int position)
{