On program close, and periodically during its running, ther is a file that I need to save data to.
I currently use this:
IO.File.Delete(Application.StartupPath & "\" & STR_DB_FILENAME)
To basically clear the file, and then create it again using streamwriter, to write everything all over again. (I have a hashtable in memory and in case of new data added to it, I save everything on close)
But I jsut got done reading up on System.IO.FileMode.Truncate, and see that what it does is simply keep the file, but clear it.
I am wondering if it would be better/more efficient/faster/etc. to use truncate instead of my delete method?
thanks
I currently use this:
IO.File.Delete(Application.StartupPath & "\" & STR_DB_FILENAME)
To basically clear the file, and then create it again using streamwriter, to write everything all over again. (I have a hashtable in memory and in case of new data added to it, I save everything on close)
But I jsut got done reading up on System.IO.FileMode.Truncate, and see that what it does is simply keep the file, but clear it.
I am wondering if it would be better/more efficient/faster/etc. to use truncate instead of my delete method?
thanks