public void SetCustomAttribute(Type type, Attribute[] values, MemberTypes memberTypes)
        {
            var hashcode = type.FullName.GetHashCode() + memberTypes.GetHashCode();

            if (this.customAttributes.ContainsKey(hashcode))
            {
                this.customAttributes[hashcode].Concat(values);
            }
            else
            {
                this.customAttributes[hashcode] = values;
            }
        }
Example #2
0
        /// <summary>
        /// Gets the cache key.
        /// </summary>
        /// <returns></returns>
        protected internal override int GetCacheKey()
        {
            int key = ((sourceType.GetHashCode() << 32) + CallInfo.TargetType.GetHashCode()) ^
                      (CallInfo.BindingFlags.GetHashCode() ^ sourceMemberTypes.GetHashCode() ^ targetMemberTypes.GetHashCode());

            if (names != null && names.Length > 0)
            {
                for (int index = 0; index < names.Length; index++)
                {
                    var name = names[index];
                    key += name.GetHashCode();
                }
            }
            return(key);
        }