public async Task <T> RequestWithObject <T>(string methodName, object parameter) { var id = Interlocked.Increment(ref _requestId).ToString(); var response = new CallerResponse <T>(id); _tasks.Add(id, response); await Send(ProtocolExtensions.Request(id, methodName, parameter)).ConfigureAwait(false); return(await response.Task.ConfigureAwait(false)); }
public async Task <T> Request <T>(string methodName, params object[] values) { var id = Interlocked.Decrement(ref _requestId).ToString(); var response = new CallerResponse <T>(id); lock (_tasks) { _tasks.Add(id, response); } await Send(ProtocolExtensions.Request(id, methodName, values)).ConfigureAwait(false); return(await response.Task.ConfigureAwait(false)); }