From e3dabf8cb72a9473bfbb97259287fc7f6e306af4 Mon Sep 17 00:00:00 2001 From: C9Glax <13404778+C9Glax@users.noreply.github.com> Date: Sun, 5 Feb 2023 20:03:33 +0100 Subject: [PATCH] override Equals with check if lat and lon are equal --- OSMDatastructure/Coordinates.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/OSMDatastructure/Coordinates.cs b/OSMDatastructure/Coordinates.cs index 368af4d..9bb6ff5 100644 --- a/OSMDatastructure/Coordinates.cs +++ b/OSMDatastructure/Coordinates.cs @@ -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; + } } } \ No newline at end of file