View Single Post
Old 05-29-2007, 06:33 AM   #10 (permalink)
Nooze2k
Tilted
 
Location: Ontario, Canada
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
Nooze2k is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62