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
- AssertHelper.cs
- SQLBinaryStorage.cs
- PersistChildrenAttribute.cs
- TableRowCollection.cs
- OneOfTypeConst.cs
- WebErrorHandler.cs
- COM2Enum.cs
- WebPartDescription.cs
- EntityException.cs
- Thumb.cs
- Stack.cs
- cache.cs
- IApplicationTrustManager.cs
- DtdParser.cs
- EqualityComparer.cs
- PeerNearMe.cs
- InstanceData.cs
- LoginCancelEventArgs.cs
- UniqueIdentifierService.cs
- WebContext.cs
- CodePageEncoding.cs
- StorageMappingFragment.cs
- Transactions.cs
- HostingEnvironmentException.cs
- ByteStorage.cs
- TextEditorContextMenu.cs
- BlockUIContainer.cs
- DataSourceXmlSerializer.cs
- GridViewPageEventArgs.cs
- TextRangeBase.cs
- ElapsedEventArgs.cs
- WindowsEditBoxRange.cs
- MimeXmlImporter.cs
- InputProviderSite.cs
- HWStack.cs
- QualifiedCellIdBoolean.cs
- OdbcUtils.cs
- ProfileGroupSettings.cs
- Material.cs
- ToggleProviderWrapper.cs
- PropertyChangeTracker.cs
- AttributeXamlType.cs
- ResourcesBuildProvider.cs
- GenerateTemporaryAssemblyTask.cs
- DirectoryNotFoundException.cs
- SqlDelegatedTransaction.cs
- InheritablePropertyChangeInfo.cs
- FlowDocumentPaginator.cs
- TextTreeObjectNode.cs
- Size.cs
- UpDownBase.cs
- FixedSOMTableRow.cs
- NamespaceCollection.cs
- SqlRecordBuffer.cs
- StringFormat.cs
- SystemDiagnosticsSection.cs
- TextParagraph.cs
- DocumentPageHost.cs
- TypeSystem.cs
- SchemaTableOptionalColumn.cs
- IIS7WorkerRequest.cs
- ResourceCategoryAttribute.cs
- MediaPlayer.cs
- WebBrowserDocumentCompletedEventHandler.cs
- HMACSHA384.cs
- Point3DCollection.cs
- CompiledIdentityConstraint.cs
- ChtmlImageAdapter.cs
- CodeAttributeArgument.cs
- ScriptRegistrationManager.cs
- SchemaAttDef.cs
- SliderAutomationPeer.cs
- SqlDataSourceView.cs
- HttpListenerContext.cs
- ImageFormatConverter.cs
- SafeReversePInvokeHandle.cs
- PropertyNames.cs
- Control.cs
- DBDataPermissionAttribute.cs
- XmlStreamStore.cs
- WebPartHelpVerb.cs
- BufferedWebEventProvider.cs
- PrintDialogException.cs
- PerformanceCounter.cs
- ViewUtilities.cs
- autovalidator.cs
- Ref.cs
- _ProxyRegBlob.cs
- BooleanSwitch.cs
- SweepDirectionValidation.cs
- ToolStrip.cs
- StringDictionaryCodeDomSerializer.cs
- ConsoleKeyInfo.cs
- XmlReaderDelegator.cs
- Cloud.cs
- Button.cs
- AnonymousIdentificationSection.cs
- SvcMapFile.cs
- WebPartDescription.cs
- CodeDOMUtility.cs