//Serialization
TextBox1.Text = "VIJAY WELCOMES U";
XmlSerializer xmlserial = new XmlSerializer(TextBox1.Text.GetType ());
FileStream fs = File.Create("C:\\vijay.xml");
xmlserial.Serialize(fs, TextBox1.Text);
fs.Close();
//Deserialization
object a;
XmlSerializer xmlserial1 = new XmlSerializer(TextBox1.Text.GetType());
FileStream fs1 = File.OpenRead("C:\\vijay.xml");
a=xmlserial1.Deserialize(fs1);
TextBox2.Text = (Convert.ToString(a));
fs1.Close();
Output ill be:
In xml file:
Below line ill show in xml format tag with in tag name "string"
In form:
VIJAY WELCOMES U-- TextBox1
VIJAY WELCOMES U-- TextBox2
No comments:
Post a Comment