Esempio n. 1
0
        public override int GetHashCode()
        {
            if (_hashCode == 0)
            {
                int           hash;
                XmlSchemaType?schemaType;

                hash       = (int)TypeCode;
                schemaType = SchemaType;

                unchecked
                {
                    if (schemaType != null)
                    {
                        hash += (hash << 7) ^ schemaType.GetHashCode();
                    }

                    hash += (hash << 7) ^ (int)NodeKinds;
                    hash += (hash << 7) ^ Cardinality.GetHashCode();
                    hash += (hash << 7) ^ (IsStrict ? 1 : 0);

                    // Mix hash code a bit more
                    hash -= hash >> 17;
                    hash -= hash >> 11;
                    hash -= hash >> 5;
                }

                // Save hashcode.  Don't save 0, so that it won't ever be recomputed.
                _hashCode = (hash == 0) ? 1 : hash;
            }

            return(_hashCode);
        }
Esempio n. 2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Kind != global::Google.Protobuf.WellKnownTypes.Field.Types.Kind.TYPE_UNKNOWN)
            {
                hash ^= Kind.GetHashCode();
            }
            if (Cardinality != global::Google.Protobuf.WellKnownTypes.Field.Types.Cardinality.CARDINALITY_UNKNOWN)
            {
                hash ^= Cardinality.GetHashCode();
            }
            if (Number != 0)
            {
                hash ^= Number.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (TypeUrl.Length != 0)
            {
                hash ^= TypeUrl.GetHashCode();
            }
            if (OneofIndex != 0)
            {
                hash ^= OneofIndex.GetHashCode();
            }
            if (Packed != false)
            {
                hash ^= Packed.GetHashCode();
            }
            hash ^= options_.GetHashCode();
            return(hash);
        }
Esempio n. 3
0
        /// <summary>
        ///     Returns a hash code for this instance.
        /// </summary>
        /// <returns>
        ///     A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
        /// </returns>
        public override int GetHashCode( )
        {
            unchecked
            {
                int hash = 17;

                hash = hash * 92821 + TypeId.GetHashCode( );

                hash = hash * 92821 + FromId.GetHashCode( );

                hash = hash * 92821 + ToId.GetHashCode( );

                if (Cardinality != null)
                {
                    hash = hash * 92821 + Cardinality.GetHashCode( );
                }

                return(hash);
            }
        }