Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

location eq added #533

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
}
}