Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- IPipelineRuntime.cs
- WS2007FederationHttpBindingElement.cs
- ParentQuery.cs
- DataServiceQueryOfT.cs
- CodeGenerationManager.cs
- TraceHandler.cs
- relpropertyhelper.cs
- ToolStrip.cs
- FilteredDataSetHelper.cs
- util.cs
- SingleObjectCollection.cs
- __TransparentProxy.cs
- DataBoundLiteralControl.cs
- ZipIOLocalFileBlock.cs
- NonBatchDirectoryCompiler.cs
- ObjectItemCachedAssemblyLoader.cs
- DataGridColumnReorderingEventArgs.cs
- X509SubjectKeyIdentifierClause.cs
- SwitchExpression.cs
- CachedBitmap.cs
- DataServiceConfiguration.cs
- FilterEventArgs.cs
- SafeEventLogReadHandle.cs
- Selector.cs
- LoginNameDesigner.cs
- PhysicalFontFamily.cs
- AsyncSerializedWorker.cs
- BaseTransportHeaders.cs
- BooleanAnimationBase.cs
- EventRecord.cs
- complextypematerializer.cs
- OdbcDataReader.cs
- ToolStripPanelRow.cs
- DisplayNameAttribute.cs
- TTSVoice.cs
- BinaryObjectInfo.cs
- M3DUtil.cs
- RemotingException.cs
- CompensatableTransactionScopeActivity.cs
- WhitespaceRule.cs
- DecoderExceptionFallback.cs
- basenumberconverter.cs
- PixelFormatConverter.cs
- DbProviderConfigurationHandler.cs
- DesignerSerializationOptionsAttribute.cs
- ListViewPagedDataSource.cs
- ValueTypeFieldReference.cs
- IResourceProvider.cs
- InputBindingCollection.cs
- BindingsCollection.cs
- ParameterToken.cs
- SystemNetHelpers.cs
- ResourcePart.cs
- ParserExtension.cs
- XslNumber.cs
- dsa.cs
- CodeMethodInvokeExpression.cs
- InternalSafeNativeMethods.cs
- Duration.cs
- DesignTimeTemplateParser.cs
- OleCmdHelper.cs
- PermissionListSet.cs
- RectAnimationClockResource.cs
- DataTemplateKey.cs
- DetailsViewPagerRow.cs
- PerformanceCounter.cs
- HttpChannelHelper.cs
- Stack.cs
- PolyBezierSegmentFigureLogic.cs
- XPathBinder.cs
- TypeConverterHelper.cs
- XmlILStorageConverter.cs
- DBSchemaRow.cs
- EventProviderWriter.cs
- CounterSample.cs
- RegionInfo.cs
- FileSystemInfo.cs
- SizeChangedInfo.cs
- ObjectParameterCollection.cs
- ToggleProviderWrapper.cs
- CompilationRelaxations.cs
- EntityDataSourceReferenceGroup.cs
- ConfigXmlWhitespace.cs
- Path.cs
- PasswordRecovery.cs
- CompletionBookmark.cs
- DeviceSpecific.cs
- SectionXmlInfo.cs
- CheckBoxRenderer.cs
- FieldAccessException.cs
- ClientProxyGenerator.cs
- ResourcePermissionBase.cs
- QuotedPrintableStream.cs
- AssemblyGen.cs
- DbProviderFactoriesConfigurationHandler.cs
- MulticastDelegate.cs
- QueueProcessor.cs
- dataobject.cs
- CollectionCodeDomSerializer.cs
- InkCanvasAutomationPeer.cs