Share via


RAII and C#

Daniel wrote:

I've been reading your blog for quite some time, and, while I love C#, I never understood why it doesn't support RAII (Resource Acquisition Is Initialization). You know, in C++ you can acquire some resource (a handle, a file, a connection) on the class constructor and have it predictably disposed on the class destructor.

Brian Harry wrote a great post on this a couple of years ago

Comments

  • Anonymous
    April 21, 2004
    What is wrong with using C#'s Finalizer mechanisms?

    /Claus
  • Anonymous
    April 21, 2004
    It's not deterministic.
  • Anonymous
    April 22, 2004
    The comment has been removed