IteratorFilter.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / IteratorFilter.cs / 1 / IteratorFilter.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// [....] 
//-----------------------------------------------------------------------------
 
namespace MS.Internal.Xml.XPath { 
    using System;
    using System.Xml; 
    using System.Xml.XPath;
    using System.Diagnostics;
    using System.Globalization;
 
    internal class IteratorFilter : XPathNodeIterator {
        private XPathNodeIterator innerIterator; 
        private string            name; 
        private int               position = 0;
 
        internal IteratorFilter(XPathNodeIterator innerIterator, string name) {
            this.innerIterator = innerIterator;
            this.name          = name;
        } 

        private IteratorFilter(IteratorFilter it) { 
            this.innerIterator = it.innerIterator.Clone(); 
            this.name          = it.name;
            this.position      = it.position; 
        }

        public override XPathNodeIterator Clone()         { return new IteratorFilter(this); }
        public override XPathNavigator    Current         { get { return innerIterator.Current;} } 
        public override int               CurrentPosition { get { return this.position; } }
 
        public override bool MoveNext() { 
            while(innerIterator.MoveNext()) {
                if(innerIterator.Current.LocalName == this.name) { 
                    this.position ++;
                    return true;
                }
            } 
            return false;
        } 
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK