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
- PkcsUtils.cs
- DiscoveryExceptionDictionary.cs
- ObjectKeyFrameCollection.cs
- HyperLinkColumn.cs
- Guid.cs
- CheckBoxPopupAdapter.cs
- MDIControlStrip.cs
- BaseCollection.cs
- SoapSchemaMember.cs
- FilteredDataSetHelper.cs
- _HTTPDateParse.cs
- TransformerConfigurationWizardBase.cs
- MultiBindingExpression.cs
- X509CertificateValidationMode.cs
- Globals.cs
- SQLInt32.cs
- ConfigurationManagerHelper.cs
- OAVariantLib.cs
- Gdiplus.cs
- QilInvokeLateBound.cs
- SByteConverter.cs
- XmlKeywords.cs
- SystemUnicastIPAddressInformation.cs
- Merger.cs
- CompilationLock.cs
- TextParagraphCache.cs
- SqlWriter.cs
- FindCompletedEventArgs.cs
- WMIGenerator.cs
- FilterEventArgs.cs
- DirectoryObjectSecurity.cs
- FaultPropagationQuery.cs
- _SSPIWrapper.cs
- SecurityStandardsManager.cs
- BitmapImage.cs
- GradientStop.cs
- ManagedCodeMarkers.cs
- ColumnReorderedEventArgs.cs
- StylusPointProperties.cs
- OleDbParameterCollection.cs
- DesignerActionPanel.cs
- MessagePartProtectionMode.cs
- COM2Enum.cs
- InteropTrackingRecord.cs
- ImageAutomationPeer.cs
- ObjectDataSourceStatusEventArgs.cs
- EnumConverter.cs
- TypeDependencyAttribute.cs
- NextPreviousPagerField.cs
- EventBuilder.cs
- RemoveStoryboard.cs
- ControlOperationBehavior.cs
- WebPartPersonalization.cs
- DocumentReference.cs
- DataGridPageChangedEventArgs.cs
- SortFieldComparer.cs
- ExpressionDumper.cs
- DbConnectionPoolIdentity.cs
- PseudoWebRequest.cs
- FatalException.cs
- IHttpResponseInternal.cs
- HttpWebRequestElement.cs
- InstanceCreationEditor.cs
- RangeValuePatternIdentifiers.cs
- TransactionProtocolConverter.cs
- RowBinding.cs
- PagedDataSource.cs
- Point.cs
- StaticExtensionConverter.cs
- RuntimeResourceSet.cs
- DefinitionUpdate.cs
- ZoneButton.cs
- GroupBoxAutomationPeer.cs
- FormatConvertedBitmap.cs
- UInt64.cs
- DesignerHelpers.cs
- CloudCollection.cs
- ValidationErrorEventArgs.cs
- DataFormats.cs
- Page.cs
- Triplet.cs
- AttachInfo.cs
- IsolatedStorageFilePermission.cs
- StaticExtension.cs
- DependentTransaction.cs
- BatchStream.cs
- PersistenceTask.cs
- TableParaClient.cs
- PluggableProtocol.cs
- Activator.cs
- SqlDataSourceParameterParser.cs
- ProtocolsConfiguration.cs
- BuildManager.cs
- ToolStripDropDownItem.cs
- HistoryEventArgs.cs
- TableStyle.cs
- MultilineStringConverter.cs
- CompilationPass2TaskInternal.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- ObjectTag.cs