📜  如何在 c# 中比较两个实体对象以进行更新 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:32.043000             🧑  作者: Mango

代码示例2
public class ProductNumberEqualityComparer : IEqualityComparer
{
   public int GetHashCode(Product obj)
   {
      return (obj == null) ? 0 : obj.ProductNumber.GetHashCode();
   }

   public bool Equals(Product x, Product y)
   {
      if (ReferenceEquals(x, y)) return true;
      if (x == null || y == null) return false;
      return x.ProductNumber == y.ProductNumber;
   }
}