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) {