Reputation: 209
I know this is probably an easy question, but im having trouble just creating an xml file that will only create its root
i Have the following code but it doesnt work
XDocument products = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement("Users",
)
);
products.Save("hello.xml");
Upvotes: 0
Views: 653
Reputation: 75296
You need to save some where in your disk:
XDocument products = new XDocument(
new XDeclaration("1.0", "utf-8", ""),
new XElement("Users"));
products.Save("c:\\hello.xml");
Edit:
To save in current directory:
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "hello.xml");
products.Save(path);
Upvotes: 4