Ejemplo n.º 1
0
        public static GenericInstanceType MakeGenericType(GenericInstanceType type, GenericInstanceType baseType)
        {
            TypeReference[] referenceArray = new TypeReference[baseType.GenericArguments.Count];
            for (int i = 0; i < referenceArray.Length; i++)
            {
                referenceArray[i] = InflateGenericType(type, baseType.GenericArguments[i]);
            }
            GenericInstanceType type2 = new GenericInstanceType(baseType.ElementType);

            foreach (TypeReference reference in referenceArray)
            {
                TypeReference reference2;
                if ((reference.MetadataToken.TokenType == Mono.Cecil.TokenType.TypeRef) && (type2.GetAssemblyName() == reference.GetAssemblyName()))
                {
                    reference2 = ResolveType(reference);
                }
                else
                {
                    reference2 = type2.Module.ImportReference(reference);
                }
                type2.GenericArguments.Add(reference2);
            }
            return(type2);
        }