Skip to content

Instantly share code, notes, and snippets.

@wardenlym
Created May 14, 2018 11:43
Show Gist options
  • Save wardenlym/6a254de10882fe09da290025ccca6c6f to your computer and use it in GitHub Desktop.
Save wardenlym/6a254de10882fe09da290025ccca6c6f to your computer and use it in GitHub Desktop.
如果去掉msg code 的风格
class Demo
{
class Ret<R>
{
int error = -1;
R res;
}
interface request { }
interface response_of<T> { }
class a_req : request
{
}
class a_res : response_of<a_req>
{
}
delegate void rpc_callback<R>(R r);
delegate void rpc_call<T, R>(T t, rpc_callback<Ret<R>> f) where T : request where R : response_of<T>;
void rpc_invoke<T,R>(T a, rpc_callback<Ret<R>> f) where T: request where R: response_of<T>
{
}
public void test3()
{
rpc_invoke(new a_req(), (Ret<a_res> res) =>
{
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment