override Equals with check if lat and lon are equal

This commit is contained in:
C9Glax 2023-02-05 20:03:33 +01:00
parent 3350d8e3b9
commit e3dabf8cb7

View File

@ -46,5 +46,17 @@ namespace OSMDatastructure
{
return string.Format("{0} {1}", this.lat.ToString(CultureInfo.InvariantCulture), this.lon.ToString(CultureInfo.InvariantCulture));
}
public override bool Equals(object? obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
Coordinates objconv = (Coordinates)obj;
if (objconv.lat.Equals(this.lat) && objconv.lon.Equals(this.lon))
return true;
}
return false;
}
}
}