XmlDocumentに対して単純なLINQクエリを作成していますが、「型引数を明示的に指定してみてください」というエラーが発生します。これが私のC#コードです:
var Document = new XmlDocument();
Document.LoadXml(XmlFilePath);
var selectedMessage = from msg in Document.Descendants("Messages").Descendants("Message")
where msg.Attribute("Code").Value == constant
select msg;
xmlは次のようになります。
<?xml version="1.0" encoding="utf-8" ?>
<MessageService>
<Messages>
<Message Code="DE-01003" Section="Delphi Backend" Line="N/A" Claim="No" Constant="E_PHY_LN_INV_HCPCS" Description="Error reading HCPCS code on line %d (%s)" />
<Message Code="DE-01004" Section="Delphi Backend" Line="N/A" Claim="No" Constant="E_PHY_LN_RBRVS_FAMILY_INV_DT" Description="RunFamilyReduction: Invalid Date on claim line %d (%s)" />
<Message Code="DE-02002" Section="Delphi Backend" Line="N/A" Claim="No" Constant="E_AMB_LN_INV_HCPCS" Description="Invalid or missing HCPCS code on claim line %d (%s)" />
.
.
.
</Messages>
</MessageService>
.Descendantsを最初に呼び出すと、エラーが発生します。何が間違っているのかわかりません。
どんな助けでもいただければ幸いです。
ありがとう!
スーザン