pibd-12 Tangatarov.I.A. LabWork05 Base #19

Closed
sqdselo wants to merge 11 commits from LabWork05 into LabWork04
Showing only changes of commit 68f321a652 - Show all commits

View File

@ -8,39 +8,39 @@ namespace HoistingCrane.CollectionGenericObjects
{
arr = Array.Empty<T?>();
}
public int Count
public int Count
{
get { return arr.Length; }
}
get { return arr.Length; }
}
public int SetMaxCount
{
set
{
if (value > 0)
{
arr = new T?[value];
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];
}
return null;
return null;
}
public int Insert(T obj)
{
for (int i = 0; i < Count; i++)
{
if (arr[i] == null)
{
return Insert(obj, 0);
}
}
return -1;
return Insert(obj, 0);
}
public int Insert(T obj, int position)