ExtensionMethod.NET Home of 841 C#, Visual Basic, F# and Javascript extension methods


Exposes an XPathNodeIterator as an IEnumerable<XPathNavigator> for easy looping.


namespace Foo

open System.Xml.XPath

module FsExtensions =

    type XPathNodeIterator with
        /// Converts an XPathNodeIterator into a seq{XPathNavigator}.
        member this.AsEnumerable =
            this |> Seq.unfold (fun it -> match it.MoveNext() with
| false -> None 
| true -> Some(it.Current, it))


for x in iterator.AsEnumerable do
// something

Author: Joel Mueller

Submitted on: 29 okt 2010

Language: F#

Type: System.Xml.XPath.XPathNodeIterator

Views: 4106