Skip to content

Commit

Permalink
Merge pull request #537 from Softeq/feature/add-equatable-interface-f…
Browse files Browse the repository at this point in the history
…or-location-master
  • Loading branch information
wcoder authored Oct 25, 2023
2 parents 5645e21 + ee61471 commit 2505c34
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion Softeq.XToolkit.WhiteLabel/Location/LocationModel.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Developed by Softeq Development Corporation
// http://www.softeq.com

using System;

namespace Softeq.XToolkit.WhiteLabel.Location
{
public class LocationModel
public class LocationModel : IEquatable<LocationModel>
{
public LocationModel()
{
Expand All @@ -17,5 +19,31 @@ public LocationModel(double latitude, double longitude)

public double Latitude { get; set; }
public double Longitude { get; set; }

public override bool Equals(object obj)
{
return Equals(obj as LocationModel);
}

public override int GetHashCode()
{
return HashCode.Combine(Latitude, Longitude);
}

public bool Equals(LocationModel other)
{
if (ReferenceEquals(null, other))
{
return false;
}

if (ReferenceEquals(this, other))
{
return true;
}

return Latitude == other.Latitude &&
Longitude == other.Longitude;
}
}
}

0 comments on commit 2505c34

Please sign in to comment.