Exemplo n.º 1
0
        /// <summary>
        /// Returns true if ProductSubCategory instances are equal
        /// </summary>
        /// <param name="other">Instance of ProductSubCategory to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProductSubCategory other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ProductSubCategoryID == other.ProductSubCategoryID ||
                     ProductSubCategoryID != null &&
                     ProductSubCategoryID.Equals(other.ProductSubCategoryID)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ProductCategoryID == other.ProductCategoryID ||
                     ProductCategoryID != null &&
                     ProductCategoryID.Equals(other.ProductCategoryID)
                 ));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ProductSubCategoryID != null)
         {
             hashCode = hashCode * 59 + ProductSubCategoryID.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (ProductCategoryID != null)
         {
             hashCode = hashCode * 59 + ProductCategoryID.GetHashCode();
         }
         return(hashCode);
     }
 }