:usingArg: https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/using-statement[Using statement]

include::../why.adoc[]

== How to fix it

=== Code examples

==== Noncompliant code example

[source,vbnet,diff-id=1,diff-type=noncompliant]
----
Dim foo As New Disposable()
foo.Dispose()
foo.Dispose() ' Noncompliant
----

[source,vbnet,diff-id=2,diff-type=noncompliant]
----
Using bar As New Disposable()  ' Noncompliant
    bar.Dispose()
End Using
----

==== Compliant solution

[source,vbnet,diff-id=1,diff-type=compliant]
----
Dim foo As New Disposable()
foo.Dispose()
----

[source,vbnet,diff-id=2,diff-type=compliant]
----
Using bar As New Disposable()  ' Compliant

End Using
----


include::resources.adoc[]

include::../rspecator.adoc[]
