всё по красоте, сделано и сдано, лаб7

This commit is contained in:
sofiaivv 2023-12-29 18:32:48 +04:00
parent 5077f1ff45
commit c7bd11dd18

View File

@ -67,7 +67,7 @@ namespace MotorBoat.Generics
/// <returns></returns> /// <returns></returns>
public static bool operator +(BoatsGenericCollection<T, U> collect, T? obj) public static bool operator +(BoatsGenericCollection<T, U> collect, T? obj)
{ {
if (obj == null || collect == null) if (obj != null && collect != null)
{ {
collect._collection.Insert(obj); collect._collection.Insert(obj);
return true; return true;
@ -83,7 +83,7 @@ namespace MotorBoat.Generics
/// <returns></returns> /// <returns></returns>
public static T? operator -(BoatsGenericCollection<T, U>? collect, int pos) public static T? operator -(BoatsGenericCollection<T, U>? collect, int pos)
{ {
T? obj = collect._collection[pos]; T? obj = collect?._collection[pos];
if (obj != null && collect != null) if (obj != null && collect != null)
{ {
collect._collection.Remove(pos); collect._collection.Remove(pos);