I want to create several async tasks without starting them at the moment. There are no problems with untyped tasks:
private Task CreateTask() {
return new Task(
async () => await DoSomething().ConfigureAwait(false));
}
But for exception handling, I added a return value for my function. But how can I write it in the correct syntax:
private Task<bool> CreateTask() {
return new Task<bool>(
async () => await DoSomething().ConfigureAwait(false));
}
I get a message that an asynchronous lambda expression cannot be converted to func. So my question is: how is it spelled correctly?
source
share