Suppose I have a method called fooAsync()
:
public Task<T> FooAsync<T>(T foo, T bar)
{
// do some stuff
var returnFoo = await netLibraryMethodAsync(x, y, z);
// do some more stuff
return returnFoo as T;
}
Now I have an awaiter method that does only one thing call fooAsync()
.
public Task<string> BarAsync(string foo, string bar)
{
return this.FooAsync(foo, bar);
}
My question here is that: inside BarAsync, should I use return await this.FooAsync()
or return this.FooAsync()
and why?
I have tried looking around but haven't found a conclusive answer for this pattern.