Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

24 lines
559 B

namespace StabilityMatrix.Core.Helper;
public class PropertyComparer<T> : IEqualityComparer<T> where T : class
{
private Func<T, object> Expr { get; set; }
public PropertyComparer(Func<T, object> expr)
{
Expr = expr;
}
public bool Equals(T? x, T? y)
{
if (x == null || y == null) return false;
var first = Expr.Invoke(x);
var second = Expr.Invoke(y);
return first.Equals(second);
}
public int GetHashCode(T obj)
{
return obj.GetHashCode();
}
}