Wondering if there is a fast way, maybe with linq?, to convert a Dictionary
into a XML document. And a way to convert the xml back to a di
Dictionary to Element:
Dictionary dict = new Dictionary();
XElement el = new XElement("root",
dict.Select(kv => new XElement(kv.Key, kv.Value)));
Element to Dictionary:
XElement rootElement = XElement.Parse("value ");
Dictionary dict = new Dictionary();
foreach(var el in rootElement.Elements())
{
dict.Add(el.Name.LocalName, el.Value);
}