Sunday, July 28, 2013

How to convert class to xml in c#


public void SerializeToXML(yourclass obj)
 {
   XmlSerializer serializer = new XmlSerializer(typeof(yourclass));
   TextWriter txtWriter = new StreamWriter(@"Physicaladdress\fielName.xml");
   serializer.Serialize(txtWriter, obj);
   txtWriter.Close();
 }

No comments:

Post a Comment

Comments

Protected by Copyscape Plagiarism Software