Пример #1
0
        public override int GetHashCode()
        {
            var hashCode = -931275965;

            hashCode = hashCode * -1521134295 + ProductID.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ProductName);

            hashCode = hashCode * -1521134295 + EqualityComparer <Supplier> .Default.GetHashCode(Supplier);

            hashCode = hashCode * -1521134295 + EqualityComparer <Category> .Default.GetHashCode(Category);

            hashCode = hashCode * -1521134295 + UnitsInStock.GetHashCode();
            hashCode = hashCode * -1521134295 + UnitsOnOrder.GetHashCode();
            hashCode = hashCode * -1521134295 + ReorderLevel.GetHashCode();
            return(hashCode);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id;
         hashCode = (hashCode * 397) ^ (ProductName != null ? ProductName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ SupplierId;
         hashCode = (hashCode * 397) ^ CategoryId;
         hashCode = (hashCode * 397) ^ (QuantityPerUnit != null ? QuantityPerUnit.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UnitPrice.GetHashCode();
         hashCode = (hashCode * 397) ^ UnitsInStock.GetHashCode();
         hashCode = (hashCode * 397) ^ UnitsOnOrder.GetHashCode();
         hashCode = (hashCode * 397) ^ ReorderLevel.GetHashCode();
         hashCode = (hashCode * 397) ^ Discontinued.GetHashCode();
         return(hashCode);
     }
 }