From fb1f6068c58fa602004a2aabef48cf797598e665 Mon Sep 17 00:00:00 2001 From: kirkorovka <147087189+kirkorovka@users.noreply.github.com> Date: Mon, 6 May 2024 18:24:37 +0400 Subject: [PATCH] LabWork4 --- .../MassiveGenericObjects.cs | 17 ++++++++++++++++- .../FormSAUCollection.cs | 10 +--------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/CollectionGenericObjects/MassiveGenericObjects.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/CollectionGenericObjects/MassiveGenericObjects.cs index 9a9e03d..97833a8 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/CollectionGenericObjects/MassiveGenericObjects.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/CollectionGenericObjects/MassiveGenericObjects.cs @@ -12,7 +12,22 @@ public class MassiveGenericObjects : ICollectionGenericObjects { 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() diff --git a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUCollection.cs b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUCollection.cs index e22da97..1bc46b8 100644 --- a/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUCollection.cs +++ b/Project_SelfPropelledArtilleryUnit/Project_SelfPropelledArtilleryUnit/FormSAUCollection.cs @@ -216,14 +216,6 @@ public partial class FormSAUCollection : Form } - private void maskedTextBox_MaskInputRejected(object sender, MaskInputRejectedEventArgs e) - { - - } - - private void labelCollectionName_Click(object sender, EventArgs e) - { - - } + } \ No newline at end of file