I think from my experience the best way to deal with objects like this is to use the "using" operator when opening/closing he objects. By using "using", it automatically calls any dispose/flush/close functions that an object might have.
The syntax is like the following:
using( StreamWriter strWriter = new StreamWriter ("txtFileName.txt") )
{
// do whatever you want to do with it...
//
}
When the "using" directive is out of scope/finished, it then automatically calls any cleanup functionality. I just find it is safer to use this way, and it might even be more efficient on the system (you'll have to look that up to verify).
__________________
" Can't keep my eyes from the circling skies, Tongue-tied and twisted just an earth-bound misfit, I "
Last edited by Nooze2k; 05-29-2007 at 06:36 AM..
Reason: Automerged Doublepost
|