Examples presented in this screencast:
The using statment has an entirely seperate functionallity from the using directive, but has a somewhat similar syntax. Here is an example showing the difference between the using directive and using statement:
// The using directive
using System.IO
// The using statement
using (stream =
File.Open(
"c:\testfile.txt",
FileMode.Create))
{
// some code
}
The purpose of the using statement is to ensure that each argument variable to the statement is disposed of after the statement has completed execution. In the above example, this would mean that the "stream" variable would be disposed of, or have its system resources released, once execution reached the closing brace of the statement.
This screencast is a subset of Screencast: The Using Directive, Expression, and Statement
To view this webcast directly in Windows Media Player, click on "Direct Link" above.
If you are behind a restrictive firewall, you can view this screencast Here
Viewing directly in Windows Media Player allows the use of all video playback controls, such as skipping over parts of the screencast, and viewing at 2x speed.