On 9/6/07, Russell Collins <[EMAIL PROTECTED]> wrote:
>
> I have read it in a C# cookbook.  Do you have any documentation proving
> otherwise??


http://msdn2.microsoft.com/en-us/library/system.object.finalize.aspx

"*Notes to Implementers: * *Object.Finalize* does nothing by default. It
must be overridden by a derived class only if necessary, because reclamation
during garbage collection tends to take much longer if a
*Finalize*operation must be run. "



This is a bit misleading because the first sentence says that
Object.Finalize "does nothing".  However, the key is in the last sentence,
where it says "...if a Finalize operation must be run.".
Object.Finalizedoesn't just "do nothing".  It isn't executed at all.
The object will only
be placed in the finalization queue if the class overrides the Finalize
method.

I didn't quote enough of your post because the part that was not accurate
was where you stated that an empty finalizer was executed.  It's as Richard
said, the GC ignores object.finalize.

--
Steve Johnson

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to