On Mon, Oct 5, 2009 at 10:09 PM, Benj Nunez <[email protected]> wrote:
>
> I'm expecting that every time I run the dumpToFile() method it overwrites
> the file
> that already exists. Well, apparently in my case it did not (although the
> documentation says it can.).
>
The documentation actually says it WILL overwrite a file that exists, not
that it can. 'can' implies that there are times that it 'cannot'.
*public static void WriteAllText(string path, string contents)
Member of System.IO.File
Summary:
Creates a new file, writes the specified string to the file, and then closes
the file. If the target file already exists, it is overwritten.
*
So I guess the question is, how did it 'apparently not' in your case. It did
in all my test cases:
http://dotnetdevelopment.pastebin.com/f17b0514b
I stepped thru each write, and after the debug text came up, I checked the
file.