.dispose() does not exist ?

  • Thread starter Thread starter PeteG
  • Start date Start date
P

PeteG

Hello,

Why does Idisposable not implemented by many classes of
the compact framework ?
For example, DataSet.dispose() does not exist.
So, how should i release my objects ?

Thanks,
Peter
 
Peter,

Generally you can set an object to null to help the garbage collector
release memory associated with the object.
 
Because dataset does not need to dispose of anything explicitlly. Typically
you implement IDisposable to be notified of the fact the the object is about
to buy a farm and it's time to release hardware resources or any unmanaged
resource you might have allocated (like window handles or synchronization
objects), close files, flush buffers etc. DataSet is an abstract
non-extensible object - there is no need to implement IDisposable on it. The
garbage collector will be able to deal with it nicely
 
Back
Top