示例#1
0
        /// <summary>
        ///     Returns true if ReplaceOffer instances are equal
        /// </summary>
        /// <param name="other">Instance of ReplaceOffer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ReplaceOffer other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     OfferType == other.OfferType ||
                     OfferType != null &&
                     OfferType.Equals(other.OfferType)
                     ) &&
                 (
                     Resource == other.Resource ||
                     Resource != null &&
                     Resource.Equals(other.Resource)
                 ) &&
                 (
                     OfferResourceId == other.OfferResourceId ||
                     OfferResourceId != null &&
                     OfferResourceId.Equals(other.OfferResourceId)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Rid == other.Rid ||
                     Rid != null &&
                     Rid.Equals(other.Rid)
                 ));
        }
示例#2
0
        /// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (OfferType != null)
                {
                    hash = hash * 57 + OfferType.GetHashCode();
                }

                if (Resource != null)
                {
                    hash = hash * 57 + Resource.GetHashCode();
                }

                if (OfferResourceId != null)
                {
                    hash = hash * 57 + OfferResourceId.GetHashCode();
                }

                if (Id != null)
                {
                    hash = hash * 57 + Id.GetHashCode();
                }

                if (Rid != null)
                {
                    hash = hash * 57 + Rid.GetHashCode();
                }

                if (Ts != null)
                {
                    hash = hash * 57 + Ts.GetHashCode();
                }

                if (Self != null)
                {
                    hash = hash * 57 + Self.GetHashCode();
                }

                if (Etag != null)
                {
                    hash = hash * 57 + Etag.GetHashCode();
                }

                return(hash);
            }
        }
示例#3
0
        /// <summary>
        ///     Returns true if Offer instances are equal
        /// </summary>
        /// <param name="other">Instance of Offer to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Offer other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return
                ((
                     OfferType == other.OfferType ||
                     OfferType != null &&
                     OfferType.Equals(other.OfferType)
                     ) &&
                 (
                     Resource == other.Resource ||
                     Resource != null &&
                     Resource.Equals(other.Resource)
                 ) &&
                 (
                     OfferResourceId == other.OfferResourceId ||
                     OfferResourceId != null &&
                     OfferResourceId.Equals(other.OfferResourceId)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     Rid == other.Rid ||
                     Rid != null &&
                     Rid.Equals(other.Rid)
                 ) &&
                 (
                     Ts == other.Ts ||
                     Ts != null &&
                     Ts.Equals(other.Ts)
                 ) &&
                 (
                     Self == other.Self ||
                     Self != null &&
                     Self.Equals(other.Self)
                 ) &&
                 (
                     Etag == other.Etag ||
                     Etag != null &&
                     Etag.Equals(other.Etag)
                 ));
        }