what is wrong with this code
XDocument xDocument = new XDocument();
for (int i = 0; i < 5; i++)
{
xDocument.Element("PlayerCodes").Add(
new XElement("PlayerCode", i.ToString())
);
}
xDocument.Save(@"c:\test.xml");
I am getting error " Object reference not set to an instance of an object."
Basically I want to create the xml file. It is not in existence
Please help