I have a List
\"sampleList\" which contains
Data1
Data2
Data3...
The file structure is like
<
Using the .Save method means that the output will have a BOM, which not all applications will be happy with. If you do not want a BOM, and if you are not sure then I suggest that you don't, then pass the XDocument through a writer:
using (var writer = new XmlTextWriter(".\\your.xml", new UTF8Encoding(false)))
{
doc.Save(writer);
}