brettr,
You could open the file in Truncate mode to clear the file while opening. However, I believe this will only work if the file already exists. See the code below:
using (IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication())
using (IsolatedStorageFileStream isoStream = new IsolatedStorageFileStream("test.xml", FileMode.Truncate, isoStore))
{
XmlWriter w = XmlWriter.Create(isoStream);
w.WriteStartElement("Test");
w.WriteRaw("Stuff");
w.WriteEndElement();
w.Flush();
isoStream.Flush();
isoStream.Close();
}
If this has answered your question, please click on "Mark as Answer" on this post.
Thanks,
Page Brooks, MCSD, MCAD
PageBrooks.com | RSS Feed