News for hackers. Stuff that matters.
Re:A Programming Idiom You've Never Heard Of by sdevlin on Tuesday January 03, 2012 @11:47PM (#3422806)
C#'s 'using' statements allow this kind of pattern for types implementing IDisposable. It looks something like this (might be a little off):

    using (var file = File.Open("foo.txt"))
    {
        ...
    }
Re:A Programming Idiom You've Never Heard Of by dubajj on Thursday January 05, 2012 @08:05AM (#3428529)
This is what I thought of immediately except to implement the end with behavior you have to override the IDisposable shut down sequence? (does that make sense?)