开发者

Cannot implicitly convert type 'System.Linq.IOrderedEnumerable<System.Xml.XPath.XPathNavigator>' to 'System.Xml.XPath.XPathNodeIterator'

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 nod开发者_JAVA技巧e;
return (XPathNodeIterator)randomNodeset;

Thanks for any help


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜