Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 0.37 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do you open an XML file and append data to it?
  2. XDocument usersDoc = XDocument.Load(@"Users.xml");
  3.  
  4. XElement userInfo =
  5. new XElement("Users",
  6.     new XElement("User",
  7.     new XElement("ScreenName", ScreenNameTB.Text),
  8.     new XElement("Key", KeyTB.Text),              
  9.     new XElement("UserID", UserIdTB.Text)));
  10. usersDoc.Add(userInfo);
  11. usersDoc.Save(@"Users.xml");