This has been a very good thread.  It has cleared up several issues for me.

Mark Potter

-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] Behalf Of Ryan Heath
Sent: Wednesday, January 26, 2005 12:24 PM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Disposing of objects


> I respectfully disagree that 3 is the most important option. The reason for
> the finalizer is to ensure that unmanaged resources get cleaned up even if
<snip>

I think Ian was referring to a managed class (A) that wraps a managed
class (B) that uses an unmanaged resource (R).

The class B should implement both the dispose and the finalize method;
class A should only implement the dispose but not the finalize method;
Class A cannot do anything in the finalize method regarding to class B
(it is 'verboten' to call methods of managed fields with in finalize
method), so the finalize method is not needed at all. On the other
hand, a dispose method on class A has it usefulness, since the dev can
free up R, through class A, early.

HTH
// Ryan

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

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

===================================
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