PIbd-13_Kulikova_D.R_LabWork05_Simple #7

Closed
kirkorovka_1 wants to merge 5 commits from LabWork5 into LabWork4
Showing only changes of commit 4511f7ab84 - Show all commits

View File

@ -12,9 +12,25 @@ public class MassiveGenericObjects <T> : ICollectionGenericObjects<T>
{
private T?[] _collection;
public int Count => _collection.Length;
public int SetMaxCount { set { if (value > 0) { _collection = new T?[value]; } } }
public int SetMaxCount
{
set
{
if (value > 0)
{
if (_collection.Length > 0)
{
Array.Resize(ref _collection, value);
}
else
{
_collection = new T?[value];
}
}
}
}
public MassiveGenericObjects()
{
_collection = Array.Empty<T?>();