Welcome to APLNext Sign in | Join | Help
in
Community Website
Blogs Forums

APLNext Screencasts

Screencast: The Using Statement

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

Click to watch
WatchFormat: wmv
Duration: 21:35

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.

Published Sunday, March 04, 2007 2:09 AM by administrator

Comments

No Comments
Anonymous comments are disabled

This Blog

Post Calendar

<March 2007>
SuMoTuWeThFrSa
25262728123
45678910
11121314151617
18192021222324
25262728293031
1234567

Syndication

Powered by Community Server, by Telligent Systems