Mam*_*One 2 .net xml linq linq-to-xml c#-4.0
为什么我不能调用FirstOrDefault()这个XML,而我还有其他可用XDocument的地方FirstOrDefault()?
var actual = new XDocument(
new XComment("This is a comment"),
new XElement("Root",
new XElement("Child1", "data1"),
new XElement("Child2", "data2")
));
actual.Descendants("Child1"). <- FirstOrDefault does not show up.
Run Code Online (Sandbox Code Playgroud)
您应该System.Linq在cs文件的顶部包含命名空间.
如果您正在使用ReSharper,请ctrl+alt+space在键入后尝试按下.并查找FirstOrDefault.R#有助于管理命名空间.
| 归档时间: |
|
| 查看次数: |
2274 次 |
| 最近记录: |