Parse a string in a dictionary like this,
var xml = XElement.Parse("<appSettings><add key=\"myKey\" value=\"myValue\" /></appSettings>");
var dic = xml.Descendants("add").ToDictionary(x => x.Attribute("key").Value, x => x.Attribute("value").Value);
You can get values ββlike this,
var item = dic["myKey"];
You can also change the values ββin the dictionary, for example,
dic["myKey"] = "new val";
XElement ,
var newXml = new XElement("appSettings", dic.Select(d => new XElement("add", new XAttribute("key", d.Key), new XAttribute("value", d.Value))));