Updated MongoId to implement IComparable<MongoId>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace SPTarkov.Server.Core.Models.Common;
|
||||
|
||||
public readonly struct MongoId : IEquatable<MongoId>
|
||||
public readonly struct MongoId : IEquatable<MongoId>, IComparable<MongoId>
|
||||
{
|
||||
private readonly string? _stringId;
|
||||
|
||||
@@ -110,6 +110,11 @@ public readonly struct MongoId : IEquatable<MongoId>
|
||||
return string.Equals(_stringId, other._stringId, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public int CompareTo(MongoId other)
|
||||
{
|
||||
return string.CompareOrdinal(_stringId, other._stringId);
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is MongoId other && Equals(other);
|
||||
|
||||
Reference in New Issue
Block a user