Hmmm after thinking about it more carefully the temp stuff should be
contained to a single method so the try/finally seems like the
simplest solution.

Cheers Michael and Joseph. :-)

Cheers  --Bec--


On Tue, Jun 15, 2010 at 3:57 PM, Michael Minutillo
<[email protected]> wrote:
> Depends on the scope of operation that the temp files are open. If you open
> a temp file inside a method and then close it again before exiting the
> method then a try/finally is appropriate. If the temp file has to remain
> open between method calls then cleaning up in IDisposable is probably for
> the best.
>
> On Tue, Jun 15, 2010 at 1:34 PM, Bec Carter <[email protected]> wrote:
>>
>> Hi!
>>
>> I have a class which uses temporary files to do its stuff. What do you
>> recommend for ensuring things get cleaned up when things go bad?
>> IDisposable? Or perhaps a big try/finally inside the class functions?
>>
>> Cheers  --Bec--
>
>
>
> --
> Michael M. Minutillo
> Indiscriminate Information Sponge
> Blog: http://wolfbyte-net.blogspot.com
>

Reply via email to