C# Object to XML

using System.IO;
using System.Xml
using System.Xml.Serialization;

Product data = JsonConvert.DeserializeObject<Product>(product01);

StringWriter sw = new StringWriter();
XmlTextWriter tw = null;

XmlSerializer serializer = new XmlSerializer(data.GetType());
tw = new XmlTextWriter(sw);
serializer.Serialize(tw, data);

strXML = sw.ToString();
Last modified: April 5, 2021

Author

Comments

Write a Reply or Comment