xml file to string c# code example Example: convert xml string to file c# File.WriteAllText("foo.xml", xml);