.NET: XDocument missing XDeclaration?

When I write this to the console, the output is missing XDeclaration content. What gives?

        var map = new XDocument(
            new XDeclaration("1.0", "UTF-8", null),
            new XElement(SiteMap.Namespace + "urlset")
        );

        Console.Write(map.ToString());

How to get an XML map, including an advertisement <?xml...>?

+3
source share

Source: https://habr.com/ru/post/1743903/


All Articles