[Mono-list] Buffering for StreamWriter

Dan Lewis dihlewis@yahoo.co.uk
Thu, 16 May 2002 19:09:49 +0100 (BST)

On Thu, 2002-05-16 at 18:58, Sanin Saracevic wrote:
> Not really sure about other languages, but I would say no. However, you can
> certainly implement it yourself since using is nothing more than a
> try-catch-finally construct with a call to Dispose() inside the finally
> clause.

In an interview, Anders Hejlsberg said that the using construct wasn't in his
initial design for C#. He said he added it after the Microsoft developers
writing the class libraries asked for a more structured way to control an
object's lifetime (maybe they were C++ developers that missed their trusty RAII

As you say, you could do without it by using a try-catch-finally construct. The
using construct gives the C# compiler and developer clearer semantics for a
common programming idiom - much like foreach does for the for loop.

Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts