This commit is contained in:
Milana Ievlewa 2023-12-18 18:54:06 +03:00
parent 6758441ee8
commit e544555b7b
2 changed files with 5 additions and 9 deletions

View File

@ -25,13 +25,6 @@ namespace speed_Boat.Generics
{
return x._entityBoat.MainColor.Name.CompareTo(y._entityBoat.MainColor.Name);
}
if(x.GetType().Name != y.GetType().Name)
{
if (x is DrawingBoat)
return -1;
else
return 1;
}
if(x.GetType().Name == y.GetType().Name && x is DrawingSpeedBoat)
{
EntitySpeedboat _speedboatX = (EntitySpeedboat)x._entityBoat;

View File

@ -18,11 +18,14 @@ namespace speed_Boat.Generics
public bool Equals(BoatsCollectionInfo? other)
{
// TODO прописать логику сравнения по свойству Name
return Name == other.Name;
if (Name == other?.Name)
return true;
return false;
}
public override int GetHashCode()
{
return this.Name.GetHashCode();
return Name.GetHashCode();
}
}
}