27 lines
599 B
C#
27 lines
599 B
C#
using CertMgr.Core.Utils;
|
|
|
|
namespace CertMgr.Certificates.CertGen.Utils;
|
|
|
|
public sealed class CollectionEquivalencyComparer<T> : IEqualityComparer<IEnumerable<T>> where T : notnull
|
|
{
|
|
public bool Equals(IEnumerable<T>? x, IEnumerable<T>? y)
|
|
{
|
|
if (x == y)
|
|
{
|
|
return true;
|
|
}
|
|
if (x == null || y == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
bool equivalent = x.Equivalent(y);
|
|
return equivalent;
|
|
}
|
|
|
|
public int GetHashCode(IEnumerable<T> obj)
|
|
{
|
|
return obj?.Sum(it => it?.GetHashCode() ?? 0) ?? 0;
|
|
}
|
|
}
|