On Tue, Jun 15, 2010 at 4:23 PM, Bec Carter <[email protected]> wrote: > 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.
Depends on the lifetime of your object. If it's just a method then your proposed approach is fine, but if the entire object itself needs those files, then it makes sense to use IDisposable. Also, if it's your own class, and you'll be using it, just follow the pattern of an IDisposable object (i.e. "using" statements) and you'll be fine. IMHO Josephs approach applies only to public API's where you can't rely on the caller to do the right thing (and Michael has already noted issues with it). > Cheers Michael and Joseph. :-) > > Cheers --Bec-- -- silky http://www.programmingbranch.com/
