Writing to an xml file C# WP7

canyUnima

New Member
The code is bellow...and I get the error at the last line : loadedData.Save("levelNo.xml");And i don't understand why as there is a method with that type of parameter in XDocument : Save(String) Serialize this XDocument to a file, overwriting an existing file, if it exists.Errors i get:
Error 2: Argument 1: cannot convert from 'string' to 'System.Xml.XmlWriter'
Error 1: The best overloaded method match for 'System.Xml.Linq.XDocument.Save(System.Xml.XmlWriter)' has some invalid arguments \[code\]XDocument loadedData = http://stackoverflow.com/questions/10736309/XDocument.Load("levelNo.xml", LoadOptions.None); XElement root = loadedData.Root; XElement asset = (XElement)root.FirstNode; asset.RemoveAll(); asset.Add(new XElement("level", levelNo)); asset.Add(new XElement("mana", player.Mana)); asset.Add(new XElement("score", score)); loadedData.Save("levelNo.xml");\[/code\]I really need some help...I've been searchig for some hours for a solution...My goal is to modify the levelNo.xml file, and then rewrite it...
 
Back
Top