private async Task Example4() { Console.WriteLine("Sum, InvokeAsync:"); using (var client = new JsonRpcClient(SampleServerUri)) { var sw = new Stopwatch(); var ran = new Random((int)DateTime.Now.Ticks); for (int i = 0; i < 10; ++i) { var x = ran.Next(0, 100); var y = ran.Next(-100, 100); sw.Restart(); var res = await client.InvokeAsync <int>("sum", new object[] { x, y }).ConfigureAwait(false); Console.WriteLine($"x = {x}, y = {y}, res = {res}, duration = {sw.Elapsed.TotalMilliseconds}ms"); } } Console.WriteLine("Sum, service method"); using (var svc = new JsonRpcClient(SampleServerUri).AsServiceContract <ISampleServiceDisposable>()) { var sw = new Stopwatch(); var ran = new Random((int)DateTime.Now.Ticks); for (int i = 0; i < 10; ++i) { var x = ran.Next(0, 100); var y = ran.Next(-100, 100); sw.Restart(); var res = await svc.Sum(x, y).ConfigureAwait(false); Console.WriteLine($"x = {x}, y = {y}, res = {res}, duration = {sw.Elapsed.TotalMilliseconds}ms"); } } }