lab8
This commit is contained in:
parent
6758441ee8
commit
e544555b7b
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user