示例#1
0
        public override int GetHashCode()
        {
            int hash = Hashing.CombinedHash(ItemType.GetHashCode(), Size);

            hash = Hashing.CombineHash(hash, Dimensions.Length);
            for (int i = 0; i < Dimensions.Length; i++)
            {
                hash = Hashing.CombineHash(hash, Dimensions[i].GetHashCode());
            }
            return(hash);
        }
            /// <summary>
            /// This function computes a hashing ID from <see name="TargetType"/> and attributes attached to it.
            /// If a type is defined as a member in a <see langword="class"/>, <see name="Attributes"/> can be obtained by calling
            /// <see cref="MemberInfo.GetCustomAttributes(bool)"/>.
            /// </summary>
            public override int GetHashCode()
            {
                if (_associatedAttribute == null)
                {
                    return(TargetType.GetHashCode());
                }

                var code = TargetType.GetHashCode();

                if (_associatedAttribute != null)
                {
                    code = Hashing.CombineHash(code, _associatedAttribute.GetHashCode());
                }
                return(code);
            }
            /// <summary>
            /// This function computes a hashing ID from <see name="TargetType"/> and attributes attached to it.
            /// If a type is defined as a member in a <see langword="class"/>, <see name="Attributes"/> can be obtained by calling
            /// <see cref="MemberInfo.GetCustomAttributes(bool)"/>.
            /// </summary>
            public override int GetHashCode()
            {
                if (_associatedAttributes == null)
                {
                    return(TargetType.GetHashCode());
                }

                var code = TargetType.GetHashCode();

                foreach (var attr in _associatedAttributes)
                {
                    code = Hashing.CombineHash(code, attr.GetHashCode());
                }
                return(code);
            }
 /// <summary>
 /// Retrieves the hash code.
 /// </summary>
 /// <returns>An integer representing the hash code.</returns>
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(RawType.GetHashCode(), Count.GetHashCode()));
 }