Exemple #1
0
        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">
        /// The other.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="GenericBaseType"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(GenericBaseType other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            //return base.Equals(other) && ParameterTypes.SequenceEqual(other.ParameterTypes) && Parameters.SequenceEqual(other.Parameters);
            return(base.Equals(other) && Parameters.SequenceEqual(other.Parameters));
        }
        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">
        /// The other.
        /// </param>
        /// <returns>
        /// <c>true</c> if the specified <see cref="GenericBaseType"/> is equal to this instance; otherwise, <c>false</c>.
        /// </returns>
        public bool Equals(GenericBaseType other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }

            if (ReferenceEquals(this, other))
            {
                return true;
            }

            //return base.Equals(other) && ParameterTypes.SequenceEqual(other.ParameterTypes) && Parameters.SequenceEqual(other.Parameters);
            return base.Equals(other) && Parameters.SequenceEqual(other.Parameters);
        }
        private static TypeBase GetGenericInstance(string typename, GenericBaseType genericType, TypeBase predefinedType)
        {
            var key = new GenericInstanceKey(typename, genericType.Parameters);

            TypeBase instanciatedType;
            lock (InstanciatedTypes)
            {
                if (!InstanciatedTypes.TryGetValue(key, out instanciatedType))
                {
                    instanciatedType = genericType.MakeGenericInstance(predefinedType);
                    InstanciatedTypes.Add(key, instanciatedType);
                }
            }
            return instanciatedType;
        }