是否有类似于JsonConvert.DeserializeAnonymousType()但与 XML 相似的内容?例如,我可以写下这样的东西:
var definition = new
{
root = new
{
id = 0,
data = ""
}
};
string inputXmlString = @"<root><id>345</id><data>Sunday</data></root>";
var obj = SomeXmlConvert.DeserializeAnonymousType(inputXmlString , definition);
if (obj.root.id == 345)
{
// ...
}