无法隐式转换类型“System.Linq.IOrderedEnumerable”到“System.Xml.XPath.XPathNodeIterator”
我想知道是否有人对以下错误有任何想法
无法隐式转换类型 'System.Linq.IOrderedEnumerable' 到 'System.Xml.XPath.XPathNodeIterator'
这是生成错误的代码。
var randomNodeset = from XPathNavigator node in nodeset
orderby Guid.NewGuid()
select node;
return (XPathNodeIterator)randomNodeset;
感谢您的帮助
I was wondering if anyone has an idea about the following error
Cannot implicitly convert type
'System.Linq.IOrderedEnumerable'
to
'System.Xml.XPath.XPathNodeIterator'
Here is the code generating the error.
var randomNodeset = from XPathNavigator node in nodeset
orderby Guid.NewGuid()
select node;
return (XPathNodeIterator)randomNodeset;
Thanks for any help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有两套不同的类用于在 .NET 中处理 XML:老式的基于 DOM 的类和新的 linq-to-xml 类。您将它们混合在一起,这会导致不兼容。
这是一篇关于这两种方法之间差异的文章: http://dotbert.loedeman .nl/linq-to-xml-with-xpath
There are two different sets of class for handling XML in .NET, the oldschool DOM-based classes and the new linq-to-xml classes. You're mixing them, which results in an incompatibility.
Here is an article on the differences between the two methods: http://dotbert.loedeman.nl/linq-to-xml-with-xpath