Search code examples
.netxmltextwriteroverwrite

Overwriting with a XmlTextWriter?


Simple question, how do i overwrite with a xmltextwriter?

I use var writer = new XmlTextWriter(exam.Path, null);. SO if i have a new document it writes as i should be.

But if the document already exists, how do i overwrite this document by a new document?


Solution

  • The documentation states that your usage will truncate the file and overwrite it with new content.

    filename Type: System.String The filename to write to. If the file exists, it truncates it and overwrites it with the new content.