Monday, 12 January 2015

de\serialize xml contains lists of object to lists of objects



I'm trying to save lists of object to a xml file. But when I'm save once it delete the before saving. I mean if I save on xml file 1 list of "Radar" and than save on the save xml file list of "Observer" it saves only the last list I save. There is any way to save them both ? My code to save :



XmlSerializer serializer = new XmlSerializer(typeof(List<Observer>));

using (TextWriter writer = new StreamWriter(@"C:\Users\user\Desktop\MapSample\bin\Debug\ListObserver.xml"))
{
serializer.Serialize(writer, list);
}


Hope you understand. Thanks in advice.


No comments:

Post a Comment