Having my first crack at writing a TAP asynchronous implementation of a simple command-response style comms. protocol stack.
The reference synchronous implementation provides a couple of public methods
public E SendCommand(C command);
public E SendCommandAndRetrieveResponse(C command, out R response);
(where E is some form of error code type) that both invoke a common internal
E _SendCommandAndRetrieveResponse(C command, out R response);
passing a dummy response in the case of SendCommand().
So I'm thinking that the signature of of the equivalent asynchronous methods would be
public Task<E> SendCommandAsync(C command);
public Task<Tuple<E, R>> SendCommandAndRetrieveResponseAsync(C command);
So far so good, but whats got me stumped is if I follow the synchronous model and use a common private
Task<Tuple<E, R>> _SendCommandAndRetrieveResponseAsync(C command);
how do I convert/proxy the Task<Tuple<E, R>> returned by the private method into a Task<E> for the benefit of SendCommandAsync()?
thx
Richard.