Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
C# XmlSerialization
<?xml version="1.0" encoding="utf-8"?>
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<name>testy</name>
</Person>
@Laoujin
Copy link
Author

Laoujin commented Oct 17, 2018

XmlSerializer serializer = new XmlSerializer(typeof(Person));
var writer = new StreamWriter(@"c:\temp\person.xml");
var person = new Person() {name = "testy"};
serializer.Serialize(writer, person);
writer.Close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment