Linq xml updating file

Rated 3.86/5 based on 984 customer reviews

When you change an attribute in the XElement it is reflected in the XDocument. I modified your code to do this, also added a few tweaks.Hope you find this useful: 's to the screen when typing in the pin.Let's say I want to change the balance of a specific savegame.I want to access the savegame by Id Number (these numbers are unique) Then I want to change the value of balance (for example to 50) and then save these changes to my document. I got stuck at the very first point of it i.e i cant grab the value from xml file using linq. I hope the question is understandable as I am not familiar with all the correct terms yet and as English isn't my first language.So far i got this code but it isnt working: Here's one way to change a specific value in an document.

This file is part of an ATM's database, containing the user's details. Say "User123" is login at the atm and deposit money, it must only get the balance of "User123" and change it.This is after all, the gateway to using List XDocument xml Doc = XDocument. Map Path("data.xml")); XDocument xml Doc = XDocument. Save("data.xml"); Can we really recommend calls to To List? Value == "1" select item; foreach (XElement item Element in items) xml Doc.

Leave a Reply