Answers for "how to serialize xml string in c#"

C#
1

c# serialize to xml

XmlSerializer xsSubmit = new XmlSerializer(typeof(MyObject));
 var subReq = new MyObject();
 var xml = "";

 using(var sww = new StringWriter())
 {
     using(XmlWriter writer = XmlWriter.Create(sww))
     {
         xsSubmit.Serialize(writer, subReq);
         xml = sww.ToString(); // Your XML
     }
 }
Posted by: Guest on August-03-2020

C# Answers by Framework

Browse Popular Code Answers by Language