Finializer and GC.SuppressFinialize question...

  • Thread starter Thread starter Kevin Phifer
  • Start date Start date
K

Kevin Phifer

If you are not creating a finializer in your class, but
you are implementing IDisposable, is it still a good idea
to call GC.SupressFinialize inside the dispose method?
Does this somehow make reclaimation faster?

sorry for any syntax errors, as this is more of a theory
question.... Thanx in advance....
 
It should not have any effect if it does not have a finalizer. The runtime
does not enforce any relationship between IDisposable and finalizers.

FWIW, I generally like to provide a finalizer if I implement IDispose, in
case a user of the class does not call Dispose - it provides a backstop. I
also believe it worthwhile to treat that as a programming error (at least in
development mode), as I believe that the Dispose pattern implies an API
contract that requires the client to call Dispose when it is done using the
object.
 
Dave,
Good point. The particular class I'm working on is my DAL
Base class and I have IDisposible implement to get rid of
any open connection/commands. This is begging for a
Finalizer. Thanx for the input.....
 
Back
Top