Готовая Лабораторная работа 8

This commit is contained in:
nikbel2004@outlook.com 2023-12-22 21:31:06 +04:00
parent 7553b06d96
commit 17895a1d63
2 changed files with 6 additions and 1 deletions

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tank.DrawningObjects;
using Tank.Entities;
namespace Tank
{
@ -23,6 +24,10 @@ namespace Tank
{
return x.Tank.BodyColor.Name.CompareTo(y.Tank.BodyColor.Name);
}
if (x.GetType() == y.GetType() && x is DrawTank)
{
return (x.Tank as EntityTank).AdditionalColor.Name.CompareTo((y.Tank as EntityTank).AdditionalColor.Name);
}
var speedCompare = x.Tank.Speed.CompareTo(y.Tank.Speed);
if (speedCompare != 0)
{

View File

@ -20,7 +20,7 @@ namespace Tank
public bool Equals(TankCollectionInfo? other)
{
if (other == null || Name == null || other.Name == null) return false;
if (Name == other.Name) return true;
if (Name == other?.Name) return true;
throw new NotImplementedException();
}