Eugenio Pace comments on IDisposable
Quote: "Why should a developer building "business solutions" ever care about closing a connection to a database, or even opening it?"

Eugenio has an interesting take on IDisposable, or the needs for business developers to actually care about resource acquisition or release.  He sez:

"The "using" statement is one step forward, but not enough in my opinion. In the same way you need to remember closing a connection, you need to remember using "using"."

Interesting stuff. I'm not sure the problem is as big as he makes it out though.  If you forget to close, or Dispose something, it's likely more of a performance error than a resource leak.  Eventually, the finalizer will clean up.  (Yes, I can construct code that makes it a fatal bug, but it's not often occurring in practice.)

It would be nice to create a class that had deterministic finalization, when needed though.



Eugenio's post
More on IDisposable.
Created: 12/24/2004 2:00:18 AM

Current Projects

I create content for .NET Core. My work appears in the .NET Core documentation site. I'm primarily responsible for the section that will help you learn C#.

All of these projects are Open Source (using the Creative Commons license for content, and the MIT license for code). If you would like to contribute, visit our GitHub Repository. Or, if you have questions, comments, or ideas for improvement, please create an issue for us.

I'm also the president of Humanitarian Toolbox. We build Open Source software that supports Humanitarian Disaster Relief efforts. We'd appreciate any help you can give to our projects. Look at our GitHub home page to see a list of our current projects. See what interests you, and dive in.

Or, if you have a group of volunteers, talk to us about hosting a codeathon event.