コード例 #1
0
        static Value InvokeMakeGenericType(Thread evalThread, Value type, Value[] typeParams)
        {
            var sysType       = evalThread.AppDomain.Compilation.FindType(KnownTypeCode.Type);
            var makeByRefType = sysType.GetMethods(m => m.Name == "MakeGenericType" && m.Parameters.Count == 1).FirstOrDefault();
            var tp            = Eval.NewArray(evalThread, sysType, (uint)typeParams.Length, 0);

            for (int i = 0; i < typeParams.Length; i++)
            {
                tp.SetArrayElement(evalThread, new[] { (uint)i }, typeParams[i]);
            }
            return(InvokeMethod(evalThread, makeByRefType, type, new[] { tp }));
        }