私のLINQは、私は次のクラスのリストにクエリの結果を変換するにはどうすればよいXNodeをカスタムタイプにキャストするにはどうすればよいですか? XMLクエリに
<entry>
<key>keyName</key>
<value>valueName</value>
</entry>
のリストを返します
XDocument xdoc = XDocument.Load("test.xml");
IEnumerable<XNode> lv1s = from lv1 in xdoc.Descendants("resources") select lv1.FirstNode;
のですか?
/// <remarks/>
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(AnonymousType = true)]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false)]
public partial class entry
{
private string keyField;
private string valueField;
/// <remarks/>
public string key
{
get
{
return this.keyField;
}
set
{
this.keyField = value;
}
}
/// <remarks/>
public string value
{
get
{
return this.valueField;
}
set
{
this.valueField = value;
}
}
}
コレクションをリストにする必要がある場合は、最後に '.ToList()'をスリングすることができます – Braydie