A Smith
A Smith

Reputation: 251

Write several strings to one xml file vb.net

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

Answers (3)

Per Kastman
Per Kastman

Reputation: 4504

Use file.AppendText to add to a file.

Upvotes: 0

Oded
Oded

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

Emmanuel N
Emmanuel N

Reputation: 7449

Use System.IO.File.AppendAllText instead of System.IO.File.WriteAllText

Upvotes: 0

Related Questions