问题
I have a question that is similar to this question but that differs in that in my case I am dealing with Asynchronous functions.
So as the question says I want to store a method in a variable (to call it later)
In the case of syncrhonous functions
private delegate void eventmethod(); //(for a function without arguments and return void)
private eventmethod MySavedEvent;
void D()
{
}
MySavedEvent = D;
MySavedEvent();
But what happens if the function is actually
Task<returnType> D();
How can I define the delegate there?
来源:https://stackoverflow.com/questions/52811268/storing-an-async-function-as-a-variable