My function accepts a delegate as an input parameter.
public delegate bool Callback();
public static class MyAPI
{
public static handle(Callback callback) {
...
}
}
So I am calling api with an anonymous delegate like this
MyAPI.handle(delegate
{
});
My question is: how can I call the async method on my anonymous deletion?
MyAPI.handle(delegate
{
await MyMethodAsync(...);
});
Am I getting a message that the 'wait' statement can only be used in the asynchronous anonymous method '?
The MyAPI.handle () function expects only a non async delegate. I can not change this method. How can I fix my problem?
Thanks.
source
share