By DeepSource

Consider rewriting using statement as using declaration CS-R1050


The using statement defines a scope at the end of which an object will be disposed. The downside is that this increases the indentation level of your code. However, with C# 8.0, you can use the new using declaration that no longer requires you to explicitly mention the braces. Although this reduces your code's indentation and nesting, the downside of this approach, however, is that the resource's lifetime may increase.

Bad Practice

using (var resource = new SomeResource())
    // `resource` is `dispose`d off as soon as it exits this scope.


// `resource` is now confined to the parent scope.
// This may increase its lifetime.
using var resource = new SomeResource();