Skip to content

Commit 7b497d5

Browse files
committed
Fix ValidatedStringWrapper not sorting properly
1 parent 28c61ed commit 7b497d5

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/KKManager/ModpackTool/Data/ValidatedStringWrapper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace KKManager.ModpackTool
77
{
8-
public class ValidatedStringWrapper : INotifyPropertyChanged
8+
public class ValidatedStringWrapper : INotifyPropertyChanged, IComparable<ValidatedStringWrapper>, IComparable, IEquatable<ValidatedStringWrapper>
99
{
1010
public static implicit operator string(ValidatedStringWrapper w) => w.Value;
1111

@@ -51,5 +51,9 @@ private void OnPropertyChanged(string propertyName)
5151
public bool VerifyString(string value) => VerifyValue(value);
5252

5353
public override string ToString() => Value ?? "";
54+
55+
public int CompareTo(object obj) => obj is ValidatedStringWrapper other ? CompareTo(other) : 1;
56+
public int CompareTo(ValidatedStringWrapper other) => string.Compare(Value, other.Value, StringComparison.Ordinal);
57+
public bool Equals(ValidatedStringWrapper other) => Value == other?.Value;
5458
}
5559
}

0 commit comments

Comments
 (0)