use common equality pattern
MODIFY
WalletWasabi.Gui/Models/Sorting/SortingPreference.cs
WalletWasabi.Gui/Models/Sorting/SortingPreference.cs
@@ -14,11 +14,22 @@ namespace WalletWasabi.Gui.Models.Sorting
public SortOrder SortOrder { get; set; }
public string ColumnTarget { get; set; }
- public bool Equals([AllowNull] SortingPreference other) => SortOrder == other.SortOrder && ColumnTarget == other.ColumnTarget;
-
public SortOrder Match(SortOrder targetOrd, string match)
{
return ColumnTarget == match ? targetOrd : SortOrder.None;
}
+
+ #region EqualityAndComparison
+
+ public bool Equals(SortingPreference other) => this == other;
+
+ public override int GetHashCode() => (SortOrder, ColumnTarget).GetHashCode();
+
+ public static bool operator ==(SortingPreference x, SortingPreference y)
+ => (x.SortOrder, x.ColumnTarget) == (y.SortOrder, y.ColumnTarget);
+
+ public static bool operator !=(SortingPreference x, SortingPreference y) => !(x == y);
+
+ #endregion EqualityAndComparison
}
}

use common equality pattern