Omer van Kloeten's .NET Zen

Programming is life, the rest is mere details

News

Note: This blog has moved to omervk.wordpress.com.

Omer van Kloeten's Facebook profile

Omer has been professionally developing applications over the past 8 years, both at the IDF’s IT corps and later at the Sela Technology Center, but has had the programming bug ever since he can remember himself.
As a senior developer at NuConomy, a leading web analytics and advertising startup, he leads a wide range of technologies for its flagship products.

Get Firefox


powered by Dapper 

.NET Resources

Articles :: CodeDom

Articles :: nGineer

Culture

Projects

Nested Using Statements

Just a quick note about the ongoing debate around nested using statements for multiple disposals.

True, you can do this:

using (StreamWriter w1 = File.CreateText("W1"))
    using (StreamWriter w2 = File.CreateText("W2"))
    {
        // code here
    }
but after working a lot on nGineer, I found that you can also do this:
using (StreamWriter w1 = File.CreateText("W1"),
    w2 = File.CreateText("W2"))
{
    // code here
}
which in my book, is a lot easier.

Comments

No Comments