/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { int result = BcdUsb.GetHashCode(); result = (result * 397) ^ Class.GetHashCode(); result = (result * 397) ^ SubClass.GetHashCode(); result = (result * 397) ^ Protocol.GetHashCode(); result = (result * 397) ^ MaxPacketSize0.GetHashCode(); result = (result * 397) ^ VendorID.GetHashCode(); result = (result * 397) ^ ProductID.GetHashCode(); result = (result * 397) ^ BcdDevice.GetHashCode(); result = (result * 397) ^ ManufacturerStringIndex.GetHashCode(); result = (result * 397) ^ ProductStringIndex.GetHashCode(); result = (result * 397) ^ SerialStringIndex.GetHashCode(); result = (result * 397) ^ ConfigurationCount.GetHashCode(); return(result); } }
/// <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 (ID != null) { hashCode = hashCode * 59 + ID.GetHashCode(); } if (VendorID != null) { hashCode = hashCode * 59 + VendorID.GetHashCode(); } if (Street != null) { hashCode = hashCode * 59 + Street.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (Country != null) { hashCode = hashCode * 59 + Country.GetHashCode(); } if (ZipCode != null) { hashCode = hashCode * 59 + ZipCode.GetHashCode(); } return(hashCode); } }