Пример #1
0
        public object Invoke(params object[] parameters)
        {
            object obj = Activator.CreateInstance(this.type);

            try
            {
                parameters = this.ConvertParameters(parameters);

                object returnObj = this.methodInfo.Invoke(obj, parameters);

                returnObj = RpcMethod.HandleAsyncResponses(returnObj);

                return(returnObj);
            }
            catch (Exception)
            {
                throw new RpcInvalidParametersException();
            }
        }
Пример #2
0
        public bool HasParameterSignature(object[] parameterList)
        {
            if (parameterList == null)
            {
                throw new ArgumentNullException(nameof(parameterList));
            }
            if (parameterList.Count() > this.parameterInfoList.Count())
            {
                return(false);
            }

            for (int i = 0; i < parameterList.Count(); i++)
            {
                ParameterInfo parameterInfo = this.parameterInfoList[i];
                object        parameter     = parameterList[i];
                bool          isMatch       = RpcMethod.ParameterMatches(parameterInfo, parameter);
                if (!isMatch)
                {
                    return(false);
                }
            }
            return(true);
        }