What is the difference between using and await using? And how can I decide which one to use?
- 阅读更多 关于 What is the difference between using and await using? And how can I decide which one to use?
问题 I've noticed that in some case, Visual Studio recommends to do this await using var disposable = new Disposable(); // Do something instead of this using var disposable = new Disposable(); // Do something What is the difference between using and await using ? How should I decide which one to use? 回答1: Classic sync using Classic using calls the Dispose() method of an object implementing the IDisposable interface. using var disposable = new Disposable(); // Do Something... Is equivalent to