I tried code like this.....
//Serialization
private void Serialize_Click(object sender, EventArgs e)
{
List<Personal> pdetails = new List<Personal>();
Personal personals = new Personal
{
ID = int.Parse(txtsno.Text),
Name = txtname.Text,
Phone = long.Parse(txtpno.Text),
Address = txtaddr.Text
};
pdetails.Add(personals);
XmlSerializer xmlser = new XmlSerializer(typeof(List<Personal>));
StreamWriter swtr = new StreamWriter(@"f:\serialize.xml");
xmlser.Serialize(swtr, pdetails);
swtr.Close();
}
//Deserialization
private void button3_Click(object sender, EventArgs e)
{
XmlSerializer xmlser = new XmlSerializer(typeof(List<Personal>));
StreamReader srdr = new StreamReader(@"f:\serialize.xml");
List<Personal>p = (List<Personal>)xmlser.Deserialize(srdr);
srdr.Close();
}
but i want dynamic xml serialization and deserialization...
i.e. while i serializing the objects that want to add in xml doc.. two and more input datas....
but i entering the details that creating a xml file tooo... but my probem is cant enter another input data to the existing file itself....
For that i want to use memory stream.. How to use memory stream for write more inputs in xml by clicking the buttons..
how to do deserialization for get xml to objects...