using System.Collections.Generic;
namespace StardewModdingAPI.Toolkit
{
/// A comparer for semantic versions based on the field.
public class SemanticVersionComparer : IComparer
{
/*********
** Accessors
*********/
/// A singleton instance of the comparer.
public static SemanticVersionComparer Instance { get; } = new();
/*********
** Public methods
*********/
///
public int Compare(ISemanticVersion? x, ISemanticVersion? y)
{
if (object.ReferenceEquals(x, y))
return 0;
if (x is null)
return -1;
if (y is null)
return 1;
return x.CompareTo(y);
}
}
}