Re: A re-announce on GC's defects




Barry Kelly wrote:
Michael D. Ober wrote:

You never have to call the IDispose interface. The GC will do this for you.

You never need to call Dispose. By telling the compiler that an object
class implements IDisposable, the GC will call Dispose for you before it
actually deallocates memory.

Please, educate yourself before you spread more misinformation!

Sorry, Barry, but could you provide some references? I believe your
description of how finalizers / IDisposable interact, but I too have
read (somewhere) on MSDN that the _ideal_ is to write your classes so
that if the caller forgets to Dispose your objects, it will be taken
care of in garbage collection, later.

I realize that it's possible to write classes that don't act that way;
I'm talking about "best practices" here.

I'm fully open to being corrected. This is a vague memory of "something
I read," nothing more.

.


Loading