I have a WCF service that needs to return a string of XML. But it seems like the writer only wants to build up a file, not a string. I tried:
string nextXM
Well I think the simplest and fastest solution here would be just to:
StringBuilder sb = new StringBuilder();
using (var writer = XmlWriter.Create(sb, settings))
{
... // Whatever code you have/need :)
sb = sb.Replace("encoding=\"utf-16\"", "encoding=\"utf-8\""); //Or whatever uft you want/use.
//Before you finally save it:
File.WriteAllText("path\\dataName.xml", sb.ToString());
}