Ejemplo n.º 1
0
        public static async Task <T> InvokeAsync <T>(string methodName, params object[] args)
        {
            var result = await MakeRequestAsync(methodName, args);

            /*
             * if (!result.HasResult)
             * {
             *  throw new Exception($"Method {methodName} did not return result");
             * }
             */
            object value = result.Result;

            if (value.GetType() != typeof(T))
            {
                value = RpcManager.FixType(typeof(T), value);
            }
            return((T)value);
        }