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
- XmlSiteMapProvider.cs
- AutoGeneratedFieldProperties.cs
- Vector3D.cs
- DataGridViewComponentPropertyGridSite.cs
- LoginView.cs
- WindowsUpDown.cs
- SystemResourceKey.cs
- CodeConstructor.cs
- BindingCompleteEventArgs.cs
- BaseAutoFormat.cs
- Attributes.cs
- LinqDataSourceDeleteEventArgs.cs
- odbcmetadatacolumnnames.cs
- TransformationRules.cs
- ContextBase.cs
- WeakHashtable.cs
- MDIWindowDialog.cs
- DependencyPropertyChangedEventArgs.cs
- DrawingImage.cs
- StickyNoteHelper.cs
- EndpointInfoCollection.cs
- StubHelpers.cs
- Label.cs
- HtmlDocument.cs
- ViewStateModeByIdAttribute.cs
- TypeContext.cs
- DependencyPropertyConverter.cs
- ChannelTraceRecord.cs
- SimpleType.cs
- ScriptServiceAttribute.cs
- Roles.cs
- AutomationPatternInfo.cs
- Int64Converter.cs
- AttachInfo.cs
- CodePageUtils.cs
- TimelineClockCollection.cs
- TemplateAction.cs
- GridItemPattern.cs
- QueryableDataSourceView.cs
- CookieParameter.cs
- NetStream.cs
- OleDbStruct.cs
- BulletDecorator.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- _ServiceNameStore.cs
- ArrayList.cs
- WebPartAddingEventArgs.cs
- OraclePermissionAttribute.cs
- HMACSHA512.cs
- DataServiceHost.cs
- PropertySourceInfo.cs
- ExceptionHelpers.cs
- ChtmlCommandAdapter.cs
- ToolStripGripRenderEventArgs.cs
- _DomainName.cs
- RefreshEventArgs.cs
- FolderBrowserDialogDesigner.cs
- Stack.cs
- ValidationErrorEventArgs.cs
- RelatedPropertyManager.cs
- ControlDesigner.cs
- SkewTransform.cs
- ProfilePropertySettings.cs
- ProcessProtocolHandler.cs
- StorageEntityTypeMapping.cs
- WebPartConnectionsDisconnectVerb.cs
- SecurityManager.cs
- RemotingConfigParser.cs
- Configuration.cs
- TypeElementCollection.cs
- HWStack.cs
- XamlClipboardData.cs
- ByteFacetDescriptionElement.cs
- XmlCDATASection.cs
- SqlXml.cs
- FastEncoder.cs
- SingleQueryOperator.cs
- ServiceObjectContainer.cs
- ApplicationContext.cs
- Metadata.cs
- DataControlFieldHeaderCell.cs
- RegexBoyerMoore.cs
- MemberBinding.cs
- SafeProcessHandle.cs
- ToolStripSplitStackLayout.cs
- JavaScriptSerializer.cs
- LayoutManager.cs
- DBBindings.cs
- PropertiesTab.cs
- List.cs
- HtmlForm.cs
- IteratorFilter.cs
- ImportOptions.cs
- TransactionFlowBindingElement.cs
- MultiView.cs
- _ConnectOverlappedAsyncResult.cs
- ObjectView.cs
- LinearQuaternionKeyFrame.cs
- LoginView.cs
- NetSectionGroup.cs