コード例 #1
0
        private static string SitemapToXml(Sitemap sitemap)
        {
            string xml;
            var    xmlSerialiser = new XmlSerializer(sitemap.GetType());

            using (var stringWriter = new Utf8StringWriter())
            {
                xmlSerialiser.Serialize(stringWriter, sitemap);
                xml = stringWriter.ToString();
            }

            return(xml);
        }