private TypeReference ResolveGenericInstanceType(TypeReference typeToResolve, Dictionary<TypeReference, TypeReference> genericInstanceTypeMap) { ArrayType arrayType = typeToResolve as ArrayType; if (arrayType != null) typeToResolve = (TypeReference) new ArrayType(this.ResolveGenericInstanceType(((TypeSpecification) 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(((TypeSpecification) genericInstanceType).get_ElementType(), (IEnumerable<TypeReference>) genericInstanceType.get_GenericArguments(), genericInstanceTypeMap); } return typeToResolve; }
private void AddBaseType(TypeReference typeRef, Dictionary<TypeReference, TypeReference> genericInstanceTypeMap) { TypeReference typeRef1 = typeRef.Resolve().get_BaseType(); if (typeRef1 == null) return; if (typeRef.get_IsGenericInstance() && typeRef1.get_IsGenericInstance()) { GenericInstanceType genericInstanceType = (GenericInstanceType) typeRef1; typeRef1 = this.MakeGenericInstance(((TypeSpecification) genericInstanceType).get_ElementType(), (IEnumerable<TypeReference>) genericInstanceType.get_GenericArguments(), genericInstanceTypeMap); } this.AddType(typeRef1, genericInstanceTypeMap); }