This commit is contained in:
kirkorovka 2024-05-06 18:25:36 +04:00
parent 8ec22ced57
commit 4511f7ab84

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?>();