diff --git a/osu.Game/Rulesets/IRulesetInfo.cs b/osu.Game/Rulesets/IRulesetInfo.cs
index 44731a2495..60a02212fc 100644
--- a/osu.Game/Rulesets/IRulesetInfo.cs
+++ b/osu.Game/Rulesets/IRulesetInfo.cs
@@ -11,7 +11,7 @@ namespace osu.Game.Rulesets
///
/// A representation of a ruleset's metadata.
///
- public interface IRulesetInfo : IHasOnlineID, IEquatable, IComparable
+ public interface IRulesetInfo : IHasOnlineID, IEquatable, IComparable
{
///
/// The user-exposed name of this ruleset.
diff --git a/osu.Game/Rulesets/RulesetInfo.cs b/osu.Game/Rulesets/RulesetInfo.cs
index 0a0941d1ff..88e3988431 100644
--- a/osu.Game/Rulesets/RulesetInfo.cs
+++ b/osu.Game/Rulesets/RulesetInfo.cs
@@ -12,7 +12,7 @@ namespace osu.Game.Rulesets
{
[ExcludeFromDynamicCompile]
[MapTo("Ruleset")]
- public class RulesetInfo : RealmObject, IEquatable, IRulesetInfo
+ public class RulesetInfo : RealmObject, IEquatable, IComparable, IRulesetInfo
{
[PrimaryKey]
public string ShortName { get; set; } = string.Empty;
@@ -47,7 +47,7 @@ namespace osu.Game.Rulesets
return ShortName == other.ShortName;
}
- public bool Equals(IRulesetInfo? other) => other is RulesetInfo b && Equals(b);
+ public bool Equals(IRulesetInfo? other) => other is RulesetInfo r && Equals(r);
public int CompareTo(RulesetInfo other)
{
@@ -63,6 +63,14 @@ namespace osu.Game.Rulesets
return string.Compare(ShortName, other.ShortName, StringComparison.Ordinal);
}
+ public int CompareTo(IRulesetInfo other)
+ {
+ if (!(other is RulesetInfo ruleset))
+ throw new ArgumentException($@"Object is not of type {nameof(RulesetInfo)}.", nameof(other));
+
+ return CompareTo(ruleset);
+ }
+
public override int GetHashCode()
{
// Importantly, ignore the underlying realm hash code, as it will usually not match.