Skip to content

Instantly share code, notes, and snippets.

@lcaballero
Last active December 11, 2015 12:19
Show Gist options
  • Save lcaballero/4600365 to your computer and use it in GitHub Desktop.
Save lcaballero/4600365 to your computer and use it in GitHub Desktop.
Example serializing things in C#/.NET -- I have to look this up almost everytime.
XmlSerializer xs = new XmlSerializer(typeof(Resources));
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xw.Formatting = Formatting.Indented;
xs.Serialize(xw,
new Resources
{
Caches = new List<Cache>
{
new Cache
{
ResourcePaths =
new List<string>
{
"MyPath.1"
}
}
}
});
Console.WriteLine(sw);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment