How to convert XML to Dictionary

后端 未结 3 949
孤独总比滥情好
孤独总比滥情好 2021-01-03 23:42

I\'ve xml as following:



  Log In
  

        
3条回答
  •  梦谈多话
    2021-01-04 00:10

    var xdoc = XDocument.Load(path_to_xml);
    _dictionary = xdoc.Descendants("data")
                      .ToDictionary(d => (string)d.Attribute("name"),
                                    d => (string)d);
    

提交回复
热议问题