:usingArg: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/statements/using[using] keyword

include::../why.adoc[]

== How to fix it

=== Code examples

==== Noncompliant code example

[source,csharp,diff-id=1,diff-type=noncompliant]
----
var foo = new Disposable();
foo.Dispose();
foo.Dispose(); // Noncompliant
----

[source,csharp,diff-id=2,diff-type=noncompliant]
----
using (var bar = new Disposable()) // Noncompliant
{
    bar.Dispose();
}
----

==== Compliant solution

[source,csharp,diff-id=1,diff-type=compliant]
----
var foo = new Disposable();
foo.Dispose();
----

[source,csharp,diff-id=2,diff-type=compliant]
----
using (var bar = new Disposable()) // Compliant
{

}
----


include::resources.adoc[]

include::../rspecator.adoc[]