Пример #1
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 (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();
                }

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

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

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

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

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

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

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

            return
                ((
                     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)
                 ) &&
                 (
                     Doc == other.Doc ||
                     Doc != null &&
                     Doc.Equals(other.Doc)
                 ) &&
                 (
                     Sprocs == other.Sprocs ||
                     Sprocs != null &&
                     Sprocs.Equals(other.Sprocs)
                 ) &&
                 (
                     Triggers == other.Triggers ||
                     Triggers != null &&
                     Triggers.Equals(other.Triggers)
                 ) &&
                 (
                     Udfs == other.Udfs ||
                     Udfs != null &&
                     Udfs.Equals(other.Udfs)
                 ) &&
                 (
                     Conflicts == other.Conflicts ||
                     Conflicts != null &&
                     Conflicts.Equals(other.Conflicts)
                 ) &&
                 (
                     IndexingPolicy == other.IndexingPolicy ||
                     IndexingPolicy != null &&
                     IndexingPolicy.Equals(other.IndexingPolicy)
                 ));
        }