Scorpio.Userdata.UserdataType.MakeGenericType C# (CSharp) Method

MakeGenericType() public method

初始化泛型类
public MakeGenericType ( Type parameters ) : ScriptUserdata
parameters System.Type
return Scorpio.ScriptUserdata
        public ScriptUserdata MakeGenericType(Type[] parameters) {
            Type[] types = m_Type.GetTypeInfo().GetGenericArguments();
            if (types.Length != parameters.Length)
                throw new ExecutionException(m_Script, m_Type + " 泛型类个数错误 需要:" + types.Length + " 传入:" + parameters.Length);
            int length = types.Length;
            for (int i = 0; i < length; ++i) {
                if (!types[i].GetTypeInfo().BaseType.GetTypeInfo().IsAssignableFrom(parameters[i]))
                    throw new ExecutionException(m_Script, m_Type + "泛型类第" + (i + 1) + "个参数失败 需要:" + types[i].GetTypeInfo().BaseType + " 传入:" + parameters[i]);
            }
            return m_Script.CreateUserdata(m_Type.MakeGenericType(parameters));
        }
        public abstract void AddExtensionMethod(MethodInfo method);