Exemplo n.º 1
0
#pragma warning restore

        private int CalculateHashCode()
        {
            unchecked
            {
                return(2978 * (DeclaringType.GetHashCode() ^ ReturnType.GetHashCode() ^ Name.GetHashCode() ^ Uri.ToString().GetHashCode()));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DependencyProperty"/> class.
        /// </summary>
        /// <param name="declaringType">The type which declares the property.</param>
        /// <param name="ownerType">The type which can own this property.</param>
        /// <param name="propertyType">The type of the property.</param>
        /// <param name="name">The name of the property.</param>
        /// <param name="defaultBindingMode">The default <see cref="BindingMode"/> for this property.</param>
        /// <param name="isAttachement">Specifies if the property is a attachement.</param>
        /// <param name="isReadonly">Specifies if the property is readonly and a key is required to write the property.</param>
        /// <param name="isUsingValueFactory">Specifies if the property is using a value factory for the initial value.</param>
        /// <param name="isFastProperty">Specifies if the property is accessed in a special behaviour.</param>
        internal DependencyProperty(TypeInfo declaringType, TypeInfo ownerType, TypeInfo propertyType, String name, BindingMode defaultBindingMode, Boolean isAttachement, Boolean isUsingValueFactory)
        {
            if (String.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name) + "cannot be null, empty or whitespace");
            }
            // TODO : defaultBindingMode -> Enum check


            DeclaringType       = declaringType ?? throw new ArgumentNullException(nameof(declaringType));
            PropertyType        = propertyType ?? throw new ArgumentNullException(nameof(propertyType));
            OwnerType           = ownerType ?? throw new ArgumentNullException(nameof(ownerType));
            Name                = name;
            DefaultBindingMode  = defaultBindingMode;
            IsAttachement       = isAttachement;
            IsUsingValueFactory = isUsingValueFactory;

            // Get the DependencyType for the current property and register the property
            DependencyType = DependencyType.GetDependencyType(declaringType, !isAttachement);
            DependencyType.Register(this);

            unchecked
            {
                // Precalculate the hash code if the depencency property
                _HashCode = 17;
                _HashCode = _HashCode * 23 + DeclaringType.GetHashCode();
                _HashCode = _HashCode * 23 + OwnerType.GetHashCode();
                _HashCode = _HashCode * 23 + PropertyType.GetHashCode();
                _HashCode = _HashCode * 23 + Name.GetHashCode();
            }
        }
Exemplo n.º 3
0
 public override int GetHashCode()
 {
     return
         (Name.GetHashCode() ^
          DeclaringType.GetHashCode() ^
          CollectionServices.GetArrayHashCode(GetParameterTypes()));
 }
Exemplo n.º 4
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ (DeclaringType != null ? DeclaringType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (XamlType?.GetHashCode() ?? 0);
         return(hashCode);
     }
 }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (MemberType != null ? MemberType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DeclaringType != null ? DeclaringType.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 6
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = DeclaringType.GetHashCode();
         result = (result * 397) ^ Name.GetHashCode();
         result = (result * 397) ^ PropertyType.GetHashCode();
         return(result);
     }
 }
        public override int GetHashCode()
        {
            int hash = Hash.Start;

            hash = Hash.Combine(hash, DeclaringType.GetHashCode());
            hash = Hash.Combine(hash, (GenericMethod == null ? Hash.Start : GenericMethod.GetHashCode()));
            hash = Hash.Combine(hash, GenericArguments.GetHashCode());
            hash = Hash.Combine(hash, Parameters.GetHashCode());
            return(this.Parameters.GetHashCode());
        }
Exemplo n.º 8
0
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hash = 17;
         hash = hash * 23 + DeclaringType.GetHashCode();
         hash = hash * 23 + Name.GetHashCode();
         return(hash);
     }
 }
Exemplo n.º 9
0
            public override int GetHashCode()
            {
                var hashCode = (DeclaringType?.GetHashCode() ?? 0) ^ Definition.GetHashCode();

                for (var i = 0; i < GenericArguments.Length; i++)
                {
                    hashCode ^= GenericArguments[i].GetHashCode();
                }
                return(hashCode);
            }
        public override int GetHashCode()
        {
            var hash = 17;

            hash = hash * 23 + (Name != null ? Name.GetHashCode() : 0);
            hash = hash * 23 + (FieldType != null ? FieldType.GetHashCode() : 0);
            hash = hash * 23 + IsTransient.GetHashCode();
            hash = hash * 23 + (DeclaringType != null ? DeclaringType.GetHashCode() : 0);

            return(hash);
        }
Exemplo n.º 11
0
 /// <summary>
 /// GetHashCode override
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     if (this.Name == null)
     {
         return(DeclaringType.GetHashCode());
     }
     else
     {
         return(this.Name.GetHashCode());
     }
 }
Exemplo n.º 12
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Method.GetHashCode();
         hashCode = (hashCode * 397) ^ TargetMethod.GetHashCode();
         hashCode = (hashCode * 397) ^ DeclaringType.GetHashCode();
         hashCode = (hashCode * 397) ^ TargetType.GetHashCode();
         hashCode = (hashCode * 397) ^ (int)InvocationType;
         return(hashCode);
     }
 }
Exemplo n.º 13
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = DeclaringType != null?DeclaringType.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (FullName != null ? FullName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (int)Visibility;
                return(hashCode);
            }
        }
Exemplo n.º 14
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = IsSignatureTarget.GetHashCode();
         hashCode = (hashCode * 397) ^ (DeclaringNamespace?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (DeclaringType?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Data?.GetCollectionHashCode(new[] { "ILOffset", "NativeOffset" }) ?? 0);
         hashCode = (hashCode * 397) ^ (GenericArguments?.GetCollectionHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ (Parameters?.GetCollectionHashCode() ?? 0);
         return(hashCode);
     }
 }
Exemplo n.º 15
0
 public override int GetHashCode()
 {
     unchecked {
         var hashCode = IsSignatureTarget.GetHashCode();
         hashCode = (hashCode * 397) ^ (DeclaringNamespace == null ? 0 : DeclaringNamespace.GetHashCode());
         hashCode = (hashCode * 397) ^ (DeclaringType == null ? 0 : DeclaringType.GetHashCode());
         hashCode = (hashCode * 397) ^ (Name == null ? 0 : Name.GetHashCode());
         hashCode = (hashCode * 397) ^ (Data == null ? 0 : Data.GetCollectionHashCode(_exclusions));
         hashCode = (hashCode * 397) ^ (GenericArguments == null ? 0 : GenericArguments.GetCollectionHashCode());
         hashCode = (hashCode * 397) ^ (Parameters == null ? 0 : Parameters.GetCollectionHashCode());
         return(hashCode);
     }
 }
Exemplo n.º 16
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = IsVirtual.GetHashCode();
         hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Getter != null ? Getter.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Setter != null ? Setter.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (FullName != null ? FullName.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (DeclaringType != null ? DeclaringType.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemplo n.º 17
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()
        {
            // As obtained from the Jon Skeet answer to:
            // http://stackoverflow.com/questions/263400/what-is-the-best-algorithm-for-an-overridden-system-object-gethashcode
            // And adapted towards the Modified Bernstein (shown here: http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx)
            //
            // Overflow is fine, just wrap
            unchecked
            {
                // Pick a random prime number
                int hash = 17;

                // Mash the hash together with yet another random prime number
                hash = (hash * 23) ^ ContractName.GetHashCode();
                hash = (hash * 23) ^ DeclaringType.GetHashCode();

                return(hash);
            }
        }
Exemplo n.º 18
0
 public sealed override int GetHashCode() => DeclaringType.GetHashCode() ^ _uniquifier.GetHashCode();
Exemplo n.º 19
0
 public override int GetHashCode()
 {
     return((DeclaringType != null ? DeclaringType.GetHashCode() : 0) << 5 + (MemberName != null ? MemberName.GetHashCode() : 0));
 }
Exemplo n.º 20
0
 public override int GetHashCode() => DeclaringType.GetHashCode() ^ (int)Value;
Exemplo n.º 21
0
 public override int GetHashCode()
 {
     Debug.Assert(DeclaringType != null, "XamlDirective should not call into base.GetHashCode");
     return((Name == null ?  0 : Name.GetHashCode()) ^ (int)_memberType ^ DeclaringType.GetHashCode());
 }
 public sealed override int GetHashCode() => MetadataToken.GetHashCode() ^ DeclaringType.GetHashCode();
Exemplo n.º 23
0
 public override int GetHashCode()
 {
     return(GetType().GetHashCode() ^ DeclaringType.GetHashCode() ^ MemberName.GetHashCode());
 }
Exemplo n.º 24
0
 public override int GetHashCode()
 {
     return(DeclaringType.GetHashCode() ^ Name.GetHashCode());
 }
Exemplo n.º 25
0
 /// <inheritdoc cref="object.GetHashCode"/>
 public override int GetHashCode()
 => unchecked ((Name.GetHashCode() * 397) ^ DeclaringType.GetHashCode());
Exemplo n.º 26
0
 public sealed override int GetHashCode() => _handle.GetHashCode() ^ DeclaringType.GetHashCode();
Exemplo n.º 27
0
 /// <summary>
 /// Serves as a hash function for a <see cref="Eto.AttachableMemberIdentifier"/> object.
 /// </summary>
 /// <returns>A hash code for this instance that is suitable for use in hashing algorithms and data structures such as a hash table.</returns>
 public override int GetHashCode()
 {
     return(((DeclaringType == null) ? 0 : DeclaringType.GetHashCode()) << 5 + ((MemberName == null) ? 0 : MemberName.GetHashCode()));
 }