Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to compare two entity objects in c# to update

public class ProductNumberEqualityComparer : IEqualityComparer<Product>
{
   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;
   }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #compare #entity #objects #update
ADD COMMENT
Topic
Name
9+6 =