add IComparable to SmartLabel
MODIFY
WalletWasabi/Blockchain/Analysis/Clustering/SmartLabel.cs
WalletWasabi/Blockchain/Analysis/Clustering/SmartLabel.cs
@@ -5,7 +5,7 @@ using System.Linq;
namespace WalletWasabi.Blockchain.Analysis.Clustering
{
- public class SmartLabel : IEquatable<SmartLabel>, IEquatable<string>, IEnumerable<string>
+ public class SmartLabel : IEquatable<SmartLabel>, IEquatable<string>, IEnumerable<string>, IComparable<SmartLabel>
{
public SmartLabel(params string[] labels) : this(labels as IEnumerable<string>)
{
@@ -55,6 +55,16 @@ namespace WalletWasabi.Blockchain.Analysis.Clustering
#region Equality
+ public int CompareTo(SmartLabel? other)
+ {
+ if (other is null)
+ {
+ return -1;
+ }
+
+ return string.CompareOrdinal(ToString(), other.ToString());
+ }
+
public override bool Equals(object? obj) => Equals(obj as SmartLabel) || Equals(obj as string);
public bool Equals(SmartLabel? other) => this == other;

add IComparable to SmartLabel