示例#1
0
        public object Invoke(int MethodId, params object[] args)
        {
            if (IsDisposed)
            {
                throw new Exception("The shared class is disposed");
            }

            SharedMethod method = GetMethod(MethodId);

            lock (method.InvokeLocky)
            {
                ReturnResult ret = method.Invoke(args) as ReturnResult;

                if (ret != null)
                {
                    if (ret.ExceptionOccured)
                    {
                        throw new Exception(ret.exceptionMessage);
                    }
                    return(ret.ReturnValue);
                }
                return(null);
            }
            throw new Exception("Method not found");
        }
        public object Invoke(params object[] args)
        {
            if (sharedMethod.sharedClass.IsDisposed)
            {
                throw new Exception("The shared class is disposed");
            }

            ReturnResult ret = sharedMethod.Invoke(args) as ReturnResult;

            if (ret != null)
            {
                if (ret.ExceptionOccured)
                {
                    throw new Exception(ret.exceptionMessage);
                }
                return(ret.ReturnValue);
            }
            return(null);
        }