Esempio n. 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 (Automatic != null)
                {
                    hash = hash * 57 + Automatic.GetHashCode();
                }

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

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

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

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

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

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

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

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

            return
                ((
                     Automatic == other.Automatic ||
                     Automatic != null &&
                     Automatic.Equals(other.Automatic)
                     ) &&
                 (
                     IndexingMode == other.IndexingMode ||
                     IndexingMode != null &&
                     IndexingMode.SequenceEqual(other.IndexingMode)
                 ) &&
                 (
                     IncludePaths == other.IncludePaths ||
                     IncludePaths != null &&
                     IncludePaths.Equals(other.IncludePaths)
                 ) &&
                 (
                     IndexType == other.IndexType ||
                     IndexType != null &&
                     IndexType.Equals(other.IndexType)
                 ) &&
                 (
                     NumericPrecision == other.NumericPrecision ||
                     NumericPrecision != null &&
                     NumericPrecision.Equals(other.NumericPrecision)
                 ) &&
                 (
                     StringPrecision == other.StringPrecision ||
                     StringPrecision != null &&
                     StringPrecision.Equals(other.StringPrecision)
                 ) &&
                 (
                     Path == other.Path ||
                     Path != null &&
                     Path.Equals(other.Path)
                 ) &&
                 (
                     ExcludePaths == other.ExcludePaths ||
                     ExcludePaths != null &&
                     ExcludePaths.Equals(other.ExcludePaths)
                 ));
        }