Переделал установку максимального значения

This commit is contained in:
qkrlnt 2024-04-23 12:17:25 +04:00
parent 66e147bd3a
commit 6e23967d26
3 changed files with 18 additions and 4 deletions

View File

@ -20,7 +20,7 @@ public class ListGenericObjects<T> : ICollectionGenericObjects<T>
private readonly List<T?> _collection; private readonly List<T?> _collection;
/// <summary> /// <summary>
/// Максимальо допустимое число объектов в списке /// Максимально допустимое число объектов в списке
/// </summary> /// </summary>
private int _maxCount; private int _maxCount;

View File

@ -20,8 +20,23 @@ public class MassiveGenericObjects<T> : ICollectionGenericObjects<T>
public int Count => _collection.Length; 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];
}
}
}
}
/// <summary> /// <summary>
/// Конструктор /// Конструктор
/// </summary> /// </summary>

View File

@ -108,7 +108,6 @@ public class DrawingTrain
/// <returns></returns> /// <returns></returns>
public bool SetPictureSize(int width, int height) public bool SetPictureSize(int width, int height)
{ {
//TODO!
if (_drawingMonorailWidth <= width && _drawingMonorailHeight <= height) if (_drawingMonorailWidth <= width && _drawingMonorailHeight <= height)
{ {
_pictureWidth = width; _pictureWidth = width;