Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / XPath / Internal / XPathSelectionIterator.cs / 1 / 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
- BufferedMessageWriter.cs
- QueryStringParameter.cs
- CapiHashAlgorithm.cs
- DataError.cs
- EventlogProvider.cs
- InputScopeConverter.cs
- XmlDocument.cs
- EventLogger.cs
- ResourceManager.cs
- DataGridState.cs
- AssemblyUtil.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- ApplySecurityAndSendAsyncResult.cs
- Utils.cs
- TableChangeProcessor.cs
- GridEntry.cs
- RsaEndpointIdentity.cs
- Tag.cs
- SslStreamSecurityUpgradeProvider.cs
- OracleParameter.cs
- InvokeMethodActivity.cs
- StateDesigner.CommentLayoutGlyph.cs
- SiteMapHierarchicalDataSourceView.cs
- XmlDeclaration.cs
- DesignerSerializationVisibilityAttribute.cs
- BitmapMetadata.cs
- WebControl.cs
- ToolTipAutomationPeer.cs
- DSACryptoServiceProvider.cs
- TypeSystem.cs
- FlowLayoutPanel.cs
- GridViewUpdateEventArgs.cs
- SharedDp.cs
- TreeViewEvent.cs
- CustomPopupPlacement.cs
- TemplateEditingFrame.cs
- RoutedEvent.cs
- DesignTimeTemplateParser.cs
- TextWriterTraceListener.cs
- Thread.cs
- Material.cs
- Annotation.cs
- _SSPISessionCache.cs
- JavaScriptString.cs
- WasNotInstalledException.cs
- CategoryNameCollection.cs
- PropertyGeneratedEventArgs.cs
- Drawing.cs
- OleDbDataAdapter.cs
- BigInt.cs
- ConcatQueryOperator.cs
- GPStream.cs
- UIElementParaClient.cs
- FocusWithinProperty.cs
- GraphicsContainer.cs
- DataFieldEditor.cs
- SecUtil.cs
- SchemaCollectionCompiler.cs
- Vars.cs
- ReadWriteObjectLock.cs
- HttpWriter.cs
- XmlConvert.cs
- RegionIterator.cs
- X509ChainElement.cs
- TextEndOfSegment.cs
- FixedSOMContainer.cs
- StopStoryboard.cs
- NetworkInterface.cs
- SchemaMapping.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- TaiwanCalendar.cs
- SHA1CryptoServiceProvider.cs
- HierarchicalDataTemplate.cs
- ImageCodecInfo.cs
- TrackBarDesigner.cs
- WinFormsUtils.cs
- PrintPreviewControl.cs
- ValidationHelpers.cs
- EntityViewGenerator.cs
- InfoCardSymmetricAlgorithm.cs
- DropShadowBitmapEffect.cs
- DocumentsTrace.cs
- Int32Rect.cs
- Adorner.cs
- AccessViolationException.cs
- BrowserTree.cs
- arabicshape.cs
- ServiceContractAttribute.cs
- MouseCaptureWithinProperty.cs
- OracleCommand.cs
- UnitControl.cs
- TransactionScope.cs
- RootBuilder.cs
- HtmlInputPassword.cs
- ToolStripComboBox.cs
- Switch.cs
- ReadOnlyObservableCollection.cs
- VisualStyleRenderer.cs
- HtmlPageAdapter.cs
- BamlResourceSerializer.cs