string xml = @"<?xml version='1.0' encoding='utf-8'?>
<ComputerBuildReportRequest xmlns:i='http://www.w3.org/2001/XMLSchema-instance' xmlns='http://schemas.ms.it.oem/digitaldistribution/2010/10'>
<Bindings>
<Binding>
<ProductKeyID>1000000002</ProductKeyID>
<HardwareHash>xxx</HardwareHash>
<HXSpecifics>
<UnitPartNumber>123456-789</UnitPartNumber>
</HXSpecifics>
</Binding>
<Binding>
<ProductKeyID>1000000003</ProductKeyID>
<HardwareHash>yyy</HardwareHash>
<HXSpecifics>
<UnitPartNumber>123456-787</UnitPartNumber>
</HXSpecifics>
</Binding>
</Bindings>
</ComputerBuildReportRequest>";
XDocument doc = XDocument.Parse(xml);
var elements = doc.Descendants("Binding"); // empty
以前就碰過,一直懶得研究 XDocument 到底為什麼有時候會秀逗,直接改用 XmlDocument。
這次碰到非用不可的情況,就藉機深究下。 2020年11月26日 星期四
【C#】XDocument Descendants() 取不到東西
2020年6月27日 星期六
【C#】Verify permission of specific directory
Actual verification of read permission to specific directory without opens a stream.
2018年12月19日 星期三
2018年11月7日 星期三
2018年9月9日 星期日
2018年8月20日 星期一
2018年8月19日 星期日
2018年6月25日 星期一
2018年6月24日 星期日
2018年6月21日 星期四
2017年6月30日 星期五
【ASP.NET Webform】Recursive get specific type of control in container & filter id with string
遞回取得容器控制項中的指定型別子控制項集合與篩選 ID 包含特定字串
2017年5月19日 星期五
2017年3月8日 星期三
【Resource】The type or namespace name 'XXX' does not exist in the namespace
已經加入了資源檔且命名空間也正確但 ResourceManager 找不到該資源檔命名空間。
2017年2月23日 星期四
【C#】PredicateBuilder usage tip
動態串接 AND, OR 條件應該算是非常常見的需求,在 Linq 段我們常會用 PredicateBuilder 這個擴充來達成,但這個擴充使用上我覺得不是那麼直觀,這篇主要只是要簡單紀錄下
var predicateA = PredicateBuilder.False<YourClass>(); var predicateB = PredicateBuilder.True<YourClass>();的差異
【C#】Exception when trying Where a PredicateBuilder predicate
Cannot convert expression type 'System.Linq.Expressions.Expression>' to return type 'System.Func'
無法從 'System.Linq.Expressions.Expression>' 轉換為 'System.Func'
無法從 'System.Linq.Expressions.Expression
訂閱:
文章 (Atom)