我应该等待还是只是返回任务?给出以下包装器示例,使用async / await或返回任务有什么后果?
class IFoo{
Task BarAsync();
}
class FooWrapper{
private IFoo _foo;
public Task BarAsync1()
{
Trace.WriteLine("BarAsync1 called");
return _foo.BarAsync();
}
public async Task BarAsync2(){
Trace.WriteLine("BarAsync2 called");
await _foo.BarAsync();
}
}
是否有针对simmilar场景的指导?