back

by danabramov·13y ago·view on hn ↗
There is a similar [common][1] idiom with `using` in C#. When you need to create and later dispose several resources, to avoid excessive nesting you write

    using (var outFile = new StreamReader(outputFile.OpenRead()))
    using (var expFile = new StreamReader(expectedFile.OpenRead())) 
    {
        ///...
    }
[1]: http://stackoverflow.com/a/1329765/458193