From b5620899f0d6bbdf4857da3dd08de95fd5b498ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A7=D1=83=D0=B1?= =?UTF-8?q?=D1=8B=D0=BA=D0=B8=D0=BD=D0=B0?= Date: Sat, 23 Dec 2023 18:06:12 +0400 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=82=D0=BE=D0=B3=D0=BE=D0=B2=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=20=D0=BB=D0=B0?= =?UTF-8?q?=D0=B1=D1=8B=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sailboat/Sailboat/FormBoatCollection.cs | 4 ++++ Sailboat/Sailboat/SetGeneric.cs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Sailboat/Sailboat/FormBoatCollection.cs b/Sailboat/Sailboat/FormBoatCollection.cs index 2570d28..fb973af 100644 --- a/Sailboat/Sailboat/FormBoatCollection.cs +++ b/Sailboat/Sailboat/FormBoatCollection.cs @@ -91,6 +91,10 @@ namespace Sailboat MessageBox.Show(ex.Message); _logger.LogWarning($"{ex.Message} в наборе {listBoxStorages.SelectedItem.ToString()}"); } + catch (ArgumentException ex) + { + MessageBox.Show(ex.Message); + } } private void buttonRemoveBoat_Click(object sender, EventArgs e) diff --git a/Sailboat/Sailboat/SetGeneric.cs b/Sailboat/Sailboat/SetGeneric.cs index 5ed07e7..1dccf14 100644 --- a/Sailboat/Sailboat/SetGeneric.cs +++ b/Sailboat/Sailboat/SetGeneric.cs @@ -56,7 +56,7 @@ namespace Sailboat.Generics throw new StorageOverflowException(_maxCount); if (equal != null && _places.Contains(boat, equal)) - return false; + throw new ArgumentException("Данный объект уже есть в коллекции"); _places.Insert(0, boat); return true; }