次のコードを考慮する
IEnumerable<String> query = null;
query = from x in xml.Descendants(xmlMasterContainerName).Descendants(xmlElementName)
let guid = x.Attribute("guid") ?? new XAttribute("guid", "-1")
where x.Attribute(xmlAttributeIdName).Value == xmlAttributeIdValue
select guid.Value;
query.ToList() を試行すると、「オブジェクト参照が設定されていません」というメッセージが表示されます
これは、'x.Attribute(xmlAttributeIdName).Value == xmlAttributeIdValue' が存在しない場合に、'select guid.Value' が原因である可能性が非常に高いです。
選択する前に、既存の値の where ステートメントを確認するにはどうすればよいですか? ありがとう