Is there any way to have an XDocument print the xml version when using the ToString method? Have it output something like this:
The easier way is:
var fullXml = $"{xDocument.Declaration}{xDocument}";
If your xDocument.Declaration is empty, just add it.