예제 #1
0
        private void AddBaseType(TypeReference typeRef, Dictionary <TypeReference, TypeReference> genericInstanceTypeMap)
        {
            TypeReference typeReference = typeRef.Resolve().get_BaseType();

            if (typeReference != null)
            {
                if (typeRef.get_IsGenericInstance() && typeReference.get_IsGenericInstance())
                {
                    GenericInstanceType genericInstanceType = (GenericInstanceType)typeReference;
                    typeReference = this.MakeGenericInstance(genericInstanceType.get_ElementType(), genericInstanceType.get_GenericArguments(), genericInstanceTypeMap);
                }
                this.AddType(typeReference, genericInstanceTypeMap);
            }
        }
예제 #2
0
        private TypeReference ResolveGenericInstanceType(TypeReference typeToResolve, Dictionary <TypeReference, TypeReference> genericInstanceTypeMap)
        {
            ArrayType arrayType = typeToResolve as ArrayType;

            if (arrayType != null)
            {
                typeToResolve = new ArrayType(this.ResolveGenericInstanceType(arrayType.get_ElementType(), genericInstanceTypeMap), arrayType.get_Rank());
            }
            while (genericInstanceTypeMap.ContainsKey(typeToResolve))
            {
                typeToResolve = genericInstanceTypeMap[typeToResolve];
            }
            if (typeToResolve.get_IsGenericInstance())
            {
                GenericInstanceType genericInstanceType = (GenericInstanceType)typeToResolve;
                typeToResolve = this.MakeGenericInstance(genericInstanceType.get_ElementType(), genericInstanceType.get_GenericArguments(), genericInstanceTypeMap);
            }
            return(typeToResolve);
        }