deciacco,
You should implement the IDisposable interface. In the Dispose method,
you should write the file.
The suggested pattern for implementing IDispose has the finalizer run
the same code (with a variation). For this kind of activity, I would say to
not do this, as it appears that you are looking for specific lifetime
management. Since finalization is non-deterministic, calling the code from
there would be a bad idea.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"deciacco" <a@a> wrote in message
news:(E-Mail Removed)...
> I'm using an object that has a dataset within it.
> When the object is instantiated I populate the dataset from xml files.
> I want the object to save the dataset back to the xml file before it is
> destroyed, but I'm not sure when to call this routine. Should I call it
> from the object's destructor or should it implement the IDisposable
> interface?
>
> Thanks!