.NET GC Best Practice -- ALWAYS Call Dispose
Its very common practice to not call Dispose on a lot of .NET objects, like DataSets or SqlCommands for instance. There's even been several discussion on these blogs about the best practices in some of these cases. The problem is that many of us “know” that calling Dispose on some objects actually does nothing underneath -- it simply exists due to an inheritance chain that included the IDisposable interface. So many experts (myself included) have gotten in the habit of writing the most “efficient” code, which often means the fewest lines necessary. So why call Dispose if we know it does not do anything? As my colleague Doug Ware pointed out to me, this assumes some internal knowledge that should not be relied upon and which technically could even change in the future. Instead, we should remember that the IDisposable pattern was implemented for a reason in general, and so we should follow it or risk being in error at some point. In other words, what's the harm in writing this extra line of code that “might” have significant reasons for existing.