XPathNodeIterator.AsEnumerable
Exposes an XPathNodeIterator as an IEnumerable<XPathNavigator> for easy looping.
Source
namespace Foo
open System.Xml.XPath
[<AutoOpen>]
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))
Example
for x in iterator.AsEnumerable do
// something
Author: Joel Mueller
Submitted on: 29 okt. 2010
Language: F#
Type: System.Xml.XPath.XPathNodeIterator
Views: 5312