Exemplo n.º 1
0
        public static DTypeDesc MakeGenericTypeInstantiation(DTypeDesc genericType, DTypeDesc[]/*!*/ args, int argCount)
        {
            // error already reported:
            if (genericType == null) return null;

            // checks the arguments and substitutes the default types to the missing ones if applicable:
            if (!genericType.MakeGenericArguments(ref args, ref argCount, _ReportErrorMakingInstantiation))
            {
                // some mandatory arguments are missing:
                return null;
            }

            Type[] real_args = new Type[argCount];
            for (int i = 0; i < argCount; i++)
            {
                // error already reported:
                if (args[i] == null) return null;
                real_args[i] = args[i].RealType;
            }

            Type instantiation = genericType.RealType.MakeGenericType(real_args);

            return DTypeDesc.Create(instantiation);
        }