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

            return
                ((
                     Vendor == other.Vendor ||
                     Vendor != null &&
                     Vendor.Equals(other.Vendor)
                     ) &&
                 (
                     HwRev == other.HwRev ||
                     HwRev != null &&
                     HwRev.Equals(other.HwRev)
                 ) &&
                 (
                     SwRev == other.SwRev ||
                     SwRev != null &&
                     SwRev.Equals(other.SwRev)
                 ) &&
                 (
                     SerNum == other.SerNum ||
                     SerNum != null &&
                     SerNum.Equals(other.SerNum)
                 ) &&
                 (
                     Model == other.Model ||
                     Model != null &&
                     Model.Equals(other.Model)
                 ) &&
                 (
                     Owner == other.Owner ||
                     Owner != null &&
                     Owner.Equals(other.Owner)
                 ) &&
                 (
                     PrimeOps == other.PrimeOps ||
                     PrimeOps != null &&
                     PrimeOps.Equals(other.PrimeOps)
                 ) &&
                 (
                     SecondOps == other.SecondOps ||
                     SecondOps != null &&
                     SecondOps.Equals(other.SecondOps)
                 ));
        }
Ejemplo 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 (Vendor != null)
         {
             hashCode = hashCode * 59 + Vendor.GetHashCode();
         }
         if (HwRev != null)
         {
             hashCode = hashCode * 59 + HwRev.GetHashCode();
         }
         if (SwRev != null)
         {
             hashCode = hashCode * 59 + SwRev.GetHashCode();
         }
         if (SerNum != null)
         {
             hashCode = hashCode * 59 + SerNum.GetHashCode();
         }
         if (Model != null)
         {
             hashCode = hashCode * 59 + Model.GetHashCode();
         }
         if (Owner != null)
         {
             hashCode = hashCode * 59 + Owner.GetHashCode();
         }
         if (PrimeOps != null)
         {
             hashCode = hashCode * 59 + PrimeOps.GetHashCode();
         }
         if (SecondOps != null)
         {
             hashCode = hashCode * 59 + SecondOps.GetHashCode();
         }
         return(hashCode);
     }
 }