Hello everyone,
I would just like to share with you my observation with the use of the
File.WriteAllText().
I have code like this:
public bool dumpToFile(ref StringBuilder AData, String AFileNameStr)
{
...
string AppPath = Application.StartupPath;
AppPath += "\\";
try
{
File.WriteAllText(@AppPath + AFileNameStr,
AData.ToString());
IsOk = true;
}
catch (System.ArgumentNullException)
{
throw;
}
...
}
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.).
Any comments on this? I'm aware that I can use StreamWriter as a
substitute. Your inputs
are welcome.