Last active
December 11, 2015 12:19
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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