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
- MatcherBuilder.cs
- UriExt.cs
- Base64Decoder.cs
- ListControl.cs
- NonBatchDirectoryCompiler.cs
- TypeConverter.cs
- CategoryNameCollection.cs
- SmtpNtlmAuthenticationModule.cs
- WebPartZoneCollection.cs
- IPEndPoint.cs
- XpsDocumentEvent.cs
- SchemaImporterExtension.cs
- WindowsClaimSet.cs
- CheckBox.cs
- sqlpipe.cs
- CheckBoxRenderer.cs
- Exception.cs
- RecordsAffectedEventArgs.cs
- PropertyMetadata.cs
- ObjectHelper.cs
- MenuItemBinding.cs
- MasterPage.cs
- XmlSyndicationContent.cs
- JobInputBins.cs
- IdnElement.cs
- HttpEncoder.cs
- PropertyInfoSet.cs
- BindingNavigator.cs
- ProgressBar.cs
- HtmlImage.cs
- NumberFunctions.cs
- WebPartTransformerAttribute.cs
- Timer.cs
- CustomPopupPlacement.cs
- GeometryHitTestResult.cs
- CryptoKeySecurity.cs
- IdentityHolder.cs
- URIFormatException.cs
- WsatConfiguration.cs
- XmlWhitespace.cs
- SqlInternalConnectionTds.cs
- CapabilitiesUse.cs
- UInt64Converter.cs
- ClientBuildManager.cs
- FixedSOMTableRow.cs
- StrongNameHelpers.cs
- InteropBitmapSource.cs
- _UncName.cs
- HandleValueEditor.cs
- PeerChannelListener.cs
- IListConverters.cs
- HttpRequestMessageProperty.cs
- _HeaderInfo.cs
- Path.cs
- SoapInteropTypes.cs
- BackgroundWorker.cs
- SystemIPv6InterfaceProperties.cs
- Model3DCollection.cs
- AuthenticatingEventArgs.cs
- UnsafeNativeMethods.cs
- CalendarDay.cs
- LocalizabilityAttribute.cs
- Message.cs
- OracleNumber.cs
- XmlAttributeCache.cs
- FrugalMap.cs
- RegexWriter.cs
- RowVisual.cs
- HttpCachePolicyElement.cs
- CompoundFileStorageReference.cs
- SimpleHandlerBuildProvider.cs
- NativeCppClassAttribute.cs
- CorePropertiesFilter.cs
- TemplateComponentConnector.cs
- ToolStripItemDataObject.cs
- _ConnectionGroup.cs
- MSAANativeProvider.cs
- GeneralTransform.cs
- InfoCardSchemas.cs
- ThreadSafeList.cs
- InvokePattern.cs
- RootBuilder.cs
- DockPatternIdentifiers.cs
- IPPacketInformation.cs
- CellTreeNode.cs
- SerialPinChanges.cs
- DataServiceRequestOfT.cs
- UIElementPropertyUndoUnit.cs
- XhtmlCssHandler.cs
- ConvertBinder.cs
- ComponentDispatcher.cs
- DuplicateMessageDetector.cs
- DragDrop.cs
- PaginationProgressEventArgs.cs
- MULTI_QI.cs
- FontDialog.cs
- TimeoutHelper.cs
- MemoryStream.cs
- RegionInfo.cs
- HtmlInputFile.cs