Since I don't want to use a database to save this information I'm trying to save user favorites into a Xml file and load them later.
Currently I'm using this code but this overwrites the previous Xml file completely instead of adding to it:
//Creates new filestream with create and write permissions
FileStream fs = new FileStream("Favo.Xml", FileMode.Create, FileAccess.Write);
//Calls SavoFace.cs
SaveFavo sf = new SaveFavo();
//Fills public string Name with tbname.text
sf.Name = tbName.Text;
lvFavo.Items.Add(tbName.Text);
//Adds name to the list
ls.Add(sf);
//Serializes the filestream and the list
xs.Serialize(fs, ls);
//Closes the file
fs.Close();
(This code came from a youtube video as I have never worked with Xml files before, however I can't seem to find an answer to this specific question.)
How would I go about adding to the Xml file instead of overwriting it completely?
Thank you in advance for the answer.