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
- ToggleButton.cs
- WriteFileContext.cs
- HitTestWithPointDrawingContextWalker.cs
- HandledMouseEvent.cs
- WebPartEditorCancelVerb.cs
- DocumentEventArgs.cs
- GACMembershipCondition.cs
- XmlSchemaIdentityConstraint.cs
- ReliabilityContractAttribute.cs
- RestHandlerFactory.cs
- HttpModuleCollection.cs
- EntityChangedParams.cs
- XmlWellformedWriter.cs
- MemberDescriptor.cs
- COM2Enum.cs
- AxDesigner.cs
- OdbcConnectionString.cs
- WindowExtensionMethods.cs
- PanelDesigner.cs
- WindowsListBox.cs
- FormParameter.cs
- IdentitySection.cs
- ColumnHeader.cs
- XmlNodeReader.cs
- ProcessThread.cs
- AlternationConverter.cs
- WmlValidationSummaryAdapter.cs
- InvalidFilterCriteriaException.cs
- SharedUtils.cs
- RunClient.cs
- InternalTypeHelper.cs
- BitmapEffect.cs
- NullableLongAverageAggregationOperator.cs
- BinaryMethodMessage.cs
- PrimitiveSchema.cs
- ObjectQuery_EntitySqlExtensions.cs
- ValidatorCollection.cs
- TextAutomationPeer.cs
- TreeBuilderXamlTranslator.cs
- LookupNode.cs
- Transaction.cs
- TextTreeNode.cs
- EpmAttributeNameBuilder.cs
- FillErrorEventArgs.cs
- TableRowGroup.cs
- ServiceConfigurationTraceRecord.cs
- SpecialNameAttribute.cs
- NativeObjectSecurity.cs
- UriWriter.cs
- QualifiedCellIdBoolean.cs
- IMembershipProvider.cs
- SoapTypeAttribute.cs
- ClientScriptManager.cs
- BitSet.cs
- XpsStructure.cs
- DBConnection.cs
- VirtualPathUtility.cs
- NumberSubstitution.cs
- TimelineClockCollection.cs
- CodeSubDirectoriesCollection.cs
- KeyValuePair.cs
- XamlSerializerUtil.cs
- ResourceDescriptionAttribute.cs
- RIPEMD160.cs
- NativeMethods.cs
- XmlSchemaSubstitutionGroup.cs
- PeerTransportElement.cs
- TreeNodeBindingCollection.cs
- XmlAutoDetectWriter.cs
- _SslSessionsCache.cs
- DataGridLinkButton.cs
- Cursor.cs
- Transform3DGroup.cs
- ActivityInstance.cs
- IntersectQueryOperator.cs
- BitmapEffect.cs
- MailWebEventProvider.cs
- NameHandler.cs
- XmlEntity.cs
- ValueType.cs
- XPathSelectionIterator.cs
- GenericEnumConverter.cs
- TypeSystemHelpers.cs
- CoreSwitches.cs
- Baml2006ReaderSettings.cs
- DirtyTextRange.cs
- StringAnimationBase.cs
- ComponentChangedEvent.cs
- PrintEvent.cs
- QilTargetType.cs
- PolyLineSegment.cs
- EntityContainer.cs
- ColumnProvider.cs
- MsmqHostedTransportConfiguration.cs
- WebControlsSection.cs
- DataSourceSelectArguments.cs
- DnsPermission.cs
- SmtpClient.cs
- Popup.cs
- QualificationDataItem.cs