Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / XPathSelectionIterator.cs / 1305376 / XPathSelectionIterator.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; // We need this wrapper object to: // 1. Calculate position // 2. Protect internal query.Current from user who may call MoveNext(). internal class XPathSelectionIterator : ResetableIterator { private XPathNavigator nav; private Query query; private int position; internal XPathSelectionIterator(XPathNavigator nav, Query query) { this.nav = nav.Clone(); this.query = query; } protected XPathSelectionIterator(XPathSelectionIterator it) { this.nav = it.nav.Clone(); this.query = (Query) it.query.Clone(); this.position = it.position; } public override void Reset() { this.query.Reset(); } public override bool MoveNext() { XPathNavigator n = query.Advance(); if( n != null ) { position++; if (!nav.MoveTo(n)) { nav = n.Clone(); } return true; } return false; } public override int Count { get { return query.Count; } } public override XPathNavigator Current { get { return nav; } } public override int CurrentPosition { get { return position; } } public override XPathNodeIterator Clone() { return new XPathSelectionIterator(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// 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; // We need this wrapper object to: // 1. Calculate position // 2. Protect internal query.Current from user who may call MoveNext(). internal class XPathSelectionIterator : ResetableIterator { private XPathNavigator nav; private Query query; private int position; internal XPathSelectionIterator(XPathNavigator nav, Query query) { this.nav = nav.Clone(); this.query = query; } protected XPathSelectionIterator(XPathSelectionIterator it) { this.nav = it.nav.Clone(); this.query = (Query) it.query.Clone(); this.position = it.position; } public override void Reset() { this.query.Reset(); } public override bool MoveNext() { XPathNavigator n = query.Advance(); if( n != null ) { position++; if (!nav.MoveTo(n)) { nav = n.Clone(); } return true; } return false; } public override int Count { get { return query.Count; } } public override XPathNavigator Current { get { return nav; } } public override int CurrentPosition { get { return position; } } public override XPathNodeIterator Clone() { return new XPathSelectionIterator(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- OutputCacheSection.cs
- Attributes.cs
- SQLConvert.cs
- Vector3DConverter.cs
- WindowsSlider.cs
- Int16Converter.cs
- ClientSettingsStore.cs
- EnumBuilder.cs
- CompoundFileReference.cs
- WebPartEditorApplyVerb.cs
- InfoCardPolicy.cs
- ChannelParameterCollection.cs
- TreeNodeCollection.cs
- MarginsConverter.cs
- Image.cs
- HelloMessageApril2005.cs
- FieldDescriptor.cs
- SHA1Cng.cs
- ArraySet.cs
- ADMembershipProvider.cs
- FormsAuthenticationEventArgs.cs
- HitTestDrawingContextWalker.cs
- XmlElementAttributes.cs
- FlowLayout.cs
- FixUpCollection.cs
- WebPartConnectionsConnectVerb.cs
- DoubleKeyFrameCollection.cs
- InternalResources.cs
- SQLDouble.cs
- DropTarget.cs
- ServiceOperationInvoker.cs
- DateTimeParse.cs
- SafeProcessHandle.cs
- ISAPIWorkerRequest.cs
- PathSegmentCollection.cs
- ControlParser.cs
- ClientRuntimeConfig.cs
- _NegotiateClient.cs
- HiddenField.cs
- EditingScope.cs
- SearchExpression.cs
- TreeViewDesigner.cs
- XmlFormatExtensionAttribute.cs
- RelationshipType.cs
- TextRangeEdit.cs
- ChameleonKey.cs
- KeyGesture.cs
- WeakReference.cs
- DetailsViewCommandEventArgs.cs
- HtmlInputImage.cs
- RuntimeCompatibilityAttribute.cs
- ChildDocumentBlock.cs
- NativeMethods.cs
- SchemaImporterExtensionElement.cs
- ComplexTypeEmitter.cs
- GridViewColumnHeaderAutomationPeer.cs
- NullableDoubleAverageAggregationOperator.cs
- WrappedIUnknown.cs
- InputBindingCollection.cs
- Point3D.cs
- DataAdapter.cs
- BuilderElements.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- ApplicationTrust.cs
- CryptoApi.cs
- Focus.cs
- WebReferencesBuildProvider.cs
- GeneralTransformGroup.cs
- ResXResourceReader.cs
- BufferedReadStream.cs
- XmlCharCheckingWriter.cs
- WebPartCatalogAddVerb.cs
- AliasGenerator.cs
- XmlReader.cs
- WebSysDisplayNameAttribute.cs
- ToolboxItem.cs
- RadialGradientBrush.cs
- SafeTokenHandle.cs
- WindowsSpinner.cs
- GridViewDeletedEventArgs.cs
- ToggleButton.cs
- ToolStripMenuItem.cs
- UpdateTranslator.cs
- BindingMAnagerBase.cs
- BamlTreeNode.cs
- PenThreadPool.cs
- Adorner.cs
- BaseServiceProvider.cs
- EntitySqlQueryBuilder.cs
- TreeNodeMouseHoverEvent.cs
- HtmlControlPersistable.cs
- TraceContextEventArgs.cs
- HandledEventArgs.cs
- EntityContainerRelationshipSetEnd.cs
- ConnectionStringSettings.cs
- LinearGradientBrush.cs
- CustomWebEventKey.cs
- COM2TypeInfoProcessor.cs
- PageCatalogPart.cs
- IsolatedStorageException.cs