/// <summary> /// 设置返回类型,并生成运行时委托 /// </summary> /// <param name="type">返回类型</param> /// <returns></returns> public MethodBuilder Return(Type type = null) { _return_type = type; Using(type); //根据参数,生成动态委托类型 _delegate_type = DelegateBuilder.GetDelegate(_parameters_types.ToArray(), type); return(this); }
/// <summary> /// 打包脚本,获取委托信息等 /// </summary> /// <returns>(函数名,涉及到的类,脚本体, 委托类型)</returns> public (string Flag, IEnumerable <Type> Types, string Script, Type Delegate) Package() { //未扣减脚本则构建脚本 if (Script.Length == 0) { Builder(); } //获取动态方法委托类型 DelegateType = DelegateBuilder.GetDelegate(ParametersTypes.ToArray(), ReturnType); //返回包装函数信息 return(MethodNameScript, UsingRecoder.Types, Script.ToString(), DelegateType); }