Example #1
0
        public static Func <object[], object> RegisterVoidMethod(string id, object obj, MethodInfo methodInfo)
        {
            if (string.IsNullOrEmpty(id))
            {
                throw new ArgumentException(nameof(id));
            }

            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            if (methodInfo == null)
            {
                throw new ArgumentNullException(nameof(methodInfo));
            }

            var dge = DelegateFactory.CreateReturnVoidMethod <Action <object[]> >(obj, methodInfo);
            Func <object[], object> returnValueMethod = (args) => {
                dge.Invoke(args);
                return(null);
            };

            RegisterMethod(id, returnValueMethod);
            return(returnValueMethod);
        }