Say I have method such as this:
private async Task SomeMethod()
{
await DoSomethingAsync();
await DoSomethingElseAsync();
return;
}
Given that DoSomethingElseAsync
returns a Task
it would seem like you should be able to do this:
private async Task SomeMethod()
{
await DoSomethingAsync();
return DoSomethingElseAsync();
}
but the compiler complains about this:
Since '
SomeMethod
' is an async method that returns 'Task
', a return keyword must not be followed by an object expression. Did you intend to return 'Task<T>
'?
Why is that?