forked from ddrilling/AsbCloudServer
25 lines
638 B
C#
25 lines
638 B
C#
|
using AsbCloudApp.Data;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Diagnostics.CodeAnalysis;
|
|||
|
|
|||
|
namespace AsbCloudApp.Comparators
|
|||
|
{
|
|||
|
public class ComparerIId : IComparer<IId>, IEqualityComparer<IId>
|
|||
|
{
|
|||
|
private static readonly ComparerIId instance = new ComparerIId();
|
|||
|
private ComparerIId(){}
|
|||
|
|
|||
|
public static ComparerIId GetInstance() => instance;
|
|||
|
|
|||
|
public int Compare(IId x, IId y) =>
|
|||
|
x.Id.CompareTo(y.Id);
|
|||
|
|
|||
|
public bool Equals(IId x, IId y) =>
|
|||
|
x.Id == y.Id;
|
|||
|
|
|||
|
public int GetHashCode([DisallowNull] IId obj) =>
|
|||
|
obj.GetHashCode();
|
|||
|
|
|||
|
}
|
|||
|
}
|