private static Func <string, object[]> GetOrCreateArgumentDeserializer(MethodInvocationOptions options) { var info = options.GetMethodOrThrow(); var argsClass = ArgumentList.GetArgumentClass(info.GetParameters().Select(p => p.ParameterType).ToArray()); var deserializeMethod = ArgumentList.GetDeserializer(argsClass); return(Deserialize); object[] Deserialize(string arguments) { var argsInstance = deserializeMethod(arguments); return(argsInstance.ToArray()); } }
internal static Func <string, object> GetOrCreateInvoker(MethodInvocationOptions options, Func <string, object[]> argumentDeserializer) { var method = options.GetMethodOrThrow(); return((string args) => method.Invoke(null, argumentDeserializer(args))); }