using declaration

A local variable declared with using, as in using var stream = File.OpenRead(path);, whose Dispose method runs automatically at the end of the enclosing scope.

In more detail

Dispose runs even if an exception is unwinding the scope. The older using statement does the same with braces around a block.

Related terms

Taught in

References