Skip to content

Instantly share code, notes, and snippets.

@Laoujin
Created October 17, 2018 20:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Laoujin/9b0b360b0c0cb39143990e92fa3adcef to your computer and use it in GitHub Desktop.
Save Laoujin/9b0b360b0c0cb39143990e92fa3adcef to your computer and use it in GitHub Desktop.
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