Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- XmlSchemaProviderAttribute.cs
- OutputCacheModule.cs
- ReflectPropertyDescriptor.cs
- CollectionViewProxy.cs
- ServiceOperationListItem.cs
- SrgsOneOf.cs
- SettingsPropertyCollection.cs
- CheckedPointers.cs
- DBNull.cs
- GcHandle.cs
- ElementHost.cs
- DataGridViewCellStyleChangedEventArgs.cs
- FilterQuery.cs
- columnmapfactory.cs
- LowerCaseStringConverter.cs
- ObjectViewEntityCollectionData.cs
- SeekStoryboard.cs
- HttpWebResponse.cs
- Hashtable.cs
- PersonalizationStateInfo.cs
- WebRequestModuleElementCollection.cs
- ObjectSecurity.cs
- RSAPKCS1SignatureDeformatter.cs
- CodeTypeDeclarationCollection.cs
- XmlSchemaIdentityConstraint.cs
- EventWaitHandle.cs
- StructuredType.cs
- GridViewUpdateEventArgs.cs
- MetadataArtifactLoaderFile.cs
- PackagePartCollection.cs
- XamlToRtfParser.cs
- Privilege.cs
- Base64Stream.cs
- HttpConfigurationSystem.cs
- OrderPreservingSpoolingTask.cs
- SqlDependencyUtils.cs
- Helpers.cs
- Encoder.cs
- DateTimeFormat.cs
- ReadOnlyHierarchicalDataSource.cs
- WebBrowser.cs
- followingquery.cs
- SqlRemoveConstantOrderBy.cs
- DbMetaDataFactory.cs
- TraversalRequest.cs
- ValuePattern.cs
- BamlBinaryReader.cs
- TableRow.cs
- PointCollectionValueSerializer.cs
- FormDesigner.cs
- CodeMethodReturnStatement.cs
- SafeNativeMethods.cs
- XmlFormatWriterGenerator.cs
- PropertyBuilder.cs
- FlowPosition.cs
- AnnotationAdorner.cs
- PageRequestManager.cs
- CompilerParameters.cs
- DataGridSortCommandEventArgs.cs
- SqlDependency.cs
- SqlClientFactory.cs
- AssemblyLoader.cs
- PartitionedStreamMerger.cs
- PerformanceCountersElement.cs
- OperatingSystem.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- MimePart.cs
- HtmlElement.cs
- BaseDataBoundControl.cs
- StrongTypingException.cs
- SecurityIdentifierConverter.cs
- MiniCustomAttributeInfo.cs
- SessionEndedEventArgs.cs
- WmlMobileTextWriter.cs
- ExtendedPropertyDescriptor.cs
- ObjectDataSource.cs
- PropertySegmentSerializationProvider.cs
- XmlTextWriter.cs
- GeometryDrawing.cs
- ClientFormsIdentity.cs
- x509utils.cs
- _ListenerResponseStream.cs
- CaseCqlBlock.cs
- FullTextLine.cs
- EditorBrowsableAttribute.cs
- RootBrowserWindow.cs
- LineGeometry.cs
- NetNamedPipeBinding.cs
- NodeInfo.cs
- MouseGestureValueSerializer.cs
- NavigatingCancelEventArgs.cs
- DataGridViewCellStateChangedEventArgs.cs
- ElementMarkupObject.cs
- DataGridColumnCollection.cs
- HostedHttpContext.cs
- ConsoleKeyInfo.cs
- ToolZone.cs
- activationcontext.cs
- __Filters.cs
- DataListItem.cs