Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / System.Xml / System / Xml / XPath / Internal / ResetableIterator.cs
blobe48a28e36faaa78efd78c14f53be9b0d0a2d5492
1 //------------------------------------------------------------------------------
2 // <copyright file="ResetableIterator.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
8 namespace MS.Internal.Xml.XPath {
9 using System;
10 using System.Xml;
11 using System.Xml.XPath;
12 using System.Diagnostics;
13 using System.Globalization;
15 internal abstract class ResetableIterator : XPathNodeIterator {
16 // the best place for this constructors to be is XPathNodeIterator, to avoid DCR at this time let's ground them here
17 public ResetableIterator() {
18 base.count = -1;
20 protected ResetableIterator(ResetableIterator other) {
21 base.count = other.count;
23 protected void ResetCount() {
24 base.count = -1;
27 public abstract void Reset();
28 public virtual bool MoveToPosition(int pos) {
29 Reset();
30 for(int i = CurrentPosition; i < pos ; i ++) {
31 if(!MoveNext()) {
32 return false;
35 return true;
38 // Contruct extension: CurrentPosition should return 0 if MoveNext() wasn't called after Reset()
39 // (behavior is not defined for XPathNodeIterator)
40 public abstract override int CurrentPosition { get; }