Reputation: 251
I am writing a string to a xml document.
I now have several different strings and I want to write all of them to one xml file. Is there any way of doing this instead of having numerous single xml files?
Upvotes: 0
Views: 508
Reputation: 498934
Instead of writing strings out, use XDocument
to construct the XML structure and Save
to a file.
This will keep you from making mistakes in the format of the XML file itself, as XML is not simple text, but a structured file format.
Upvotes: 2
Reputation: 7449
Use System.IO.File.AppendAllText instead of System.IO.File.WriteAllText
Upvotes: 0