|
![](/i/fill.gif) |
Darren New wrote:
>
> The destructor will close the file when the GC collects the object, but
> that might be several seconds later. And it might not run if you exit
> the program before the GC runs, but that's true of C++ also. So it's not
> quite as nicely deterministic, but it still happens eventually.
>
C# has the same issue. You can sort of work around it with the using
statement, which will call Dispose on an IDisposable object, which, in
turn, closes the file.
--
~Mike
Post a reply to this message
|
![](/i/fill.gif) |