Esempio n. 1
0
            private static InvokeOperation TryCreate <Arg1T, Arg2T, Arg3T, Arg4T, ResultT>(MethodInfo method, ParameterInfo[] parameters)
            {
                if (method == null)
                {
                    throw new ArgumentNullException("method");
                }
                if (parameters == null)
                {
                    throw new ArgumentNullException("parameters");
                }

                if (parameters.Length != 4 || method.ReturnType != typeof(ResultT) || parameters[0].ParameterType != typeof(Arg1T) ||
                    parameters[1].ParameterType != typeof(Arg2T) || parameters[2].ParameterType != typeof(Arg3T) || parameters[3].ParameterType != typeof(Arg4T))
                {
                    return(null);
                }

                var wrapper = new MethodCall(typeof(Func <Arg1T, Arg2T, Arg3T, Arg4T, ResultT>), method);

                // never happens, just for AOT
#pragma warning disable 1720
                if (parameters.Length == int.MaxValue)
                {
                    wrapper.FuncInvoker <Arg1T, Arg2T, Arg3T, Arg4T, ResultT>(null, null);
                    ((Func <Arg1T, Arg2T, Arg3T, Arg4T, ResultT>)null).Invoke(default(Arg1T), default(Arg2T), default(Arg3T), default(Arg4T));
                }
#pragma warning restore 1720

                return(wrapper.FuncInvoker <Arg1T, Arg2T, Arg3T, Arg4T, ResultT>);
            }