Skip to content

Commit

Permalink
location eq added
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirill Akulich authored and wcoder committed Oct 25, 2023
1 parent 5645e21 commit 70783d4
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 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,32 @@ 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 bool Equals(LocationModel other)
{
if (ReferenceEquals(null, other))
{
return false;
}

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

return other is LocationModel model &&
Latitude == model.Latitude &&
Longitude == model.Longitude;
}

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

0 comments on commit 70783d4

Please sign in to comment.