From 86f03f05c5978ba752d6e830dad8f324165b73c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B5=D0=BB=D1=8C=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Tue, 6 Dec 2022 21:21:18 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=B5=D1=82=D0=BE?= =?UTF-8?q?=D0=B4=D0=B0=20List.Contains?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Locomotives/Locomotives/SetLocomotivesGeneric.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Locomotives/Locomotives/SetLocomotivesGeneric.cs b/Locomotives/Locomotives/SetLocomotivesGeneric.cs index dafe755..fe6a69d 100644 --- a/Locomotives/Locomotives/SetLocomotivesGeneric.cs +++ b/Locomotives/Locomotives/SetLocomotivesGeneric.cs @@ -28,12 +28,9 @@ /// public int Insert(T locomotive) { - for (int i = 0; i < _places.Count; i++) + if (_places.Contains(locomotive)) { - if (locomotive.Equals(_places[i])) - { - throw new NotUniqueObjectException(); - } + throw new NotUniqueObjectException(); } if (_places.Count == 0) {