How to Deserialize XMLDocument to object in C#?

后端 未结 2 1738
名媛妹妹
名媛妹妹 2021-02-15 18:17

I have a .Net webserivce that accepts XML in string format. XML String sent into the webserivce can represent any Object in the system. I need to check

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-15 18:46

    Don't forget a powerfull contender, LINQ to XML!

    XElement root = XElement.Load(myfile);
    
    var foos = root.Descendants("Foo").Where(e => e.Attribute("bar") != null);
    

提交回复
热议问题