Tech Off Post

Single Post Permalink

View Thread: Involving Channel9 in .NET Framework Design Guidelines updates
  • User profile image
    Sven Groot

    Most classes that implement IDisposable will also clean up their resources in their finalizer. That doesn't help if it's something which you want to keep open for as small a time as possible, such as a database connection or file. It's nice that the finalizer will close the database connection eventually, but until the GC runs your table/record/whatever will be locked.

    If a class has a Close or Dispose method, always call it, even if the finalizer will clean up the resources as well.