C# 8 understanding await using syntax
Similar as using (...)
uses IDispose
to clean up resources, await using (...)
uses IAsyncDisposable.
This allows to perform also time-consuming tasks (e.g involving I/O) on cleanup without blocking.
If SqlConnection
implements IAsyncDisposable
interface, Resharper suggests you to switch to await using
to dispose it asynchronously using DisposeAsync
method
public interface IAsyncDisposable
{
ValueTask DisposeAsync();
}