MSFT Dynamic Linq を機能させることにある程度成功しましたが、今度は属性を含む「Where」句を作成する必要があります。
表示されるエラーは、「適用可能な集計メソッド 'First' が存在しません」です。
これが私のコードです:
where = "Element(XName.Get(\"procedure\")).Attributes(XName.Get(\"code\")).First() = \"28002\"";
var q2 = doc.Elements().Descendants("vocabularybody").AsQueryable().Where(where);
if (q2 != null && q2.Count() > 0)
foundItems.Add(item);
ここに私のXMLがあります
<vocabulary>
<vocabularyheader>
<vocabularyid>5</vocabularyid>
<vocabularyname>Scheduled Procedure</vocabularyname>
</vocabularyheader>
<vocabularybody>
<procedure code="28002" type="Surgery"/>
</vocabularybody>
</gazoontvocabulary>