Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / Xml / System / Xml / XPath / Internal / ContextQuery.cs / 1 / ContextQuery.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; internal class ContextQuery : Query { protected XPathNavigator contextNode; public ContextQuery() { this.count = 0; } protected ContextQuery(ContextQuery other) : base(other) { this.contextNode = other.contextNode; // Don't need to clone here } public override void Reset() { count = 0; } public override XPathNavigator Current { get { return contextNode; } } public override object Evaluate(XPathNodeIterator context) { contextNode = context.Current; // We don't clone here. Because we never move it. count = 0; return this; } public override XPathNavigator Advance() { if (count == 0) { count = 1; return contextNode; } return null; } public override XPathNavigator MatchNode(XPathNavigator current) { return current; } public override XPathNodeIterator Clone() { return new ContextQuery(this); } public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } } public override int CurrentPosition { get { return count; } } public override int Count { get { return 1; } } public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } } } } // 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; internal class ContextQuery : Query { protected XPathNavigator contextNode; public ContextQuery() { this.count = 0; } protected ContextQuery(ContextQuery other) : base(other) { this.contextNode = other.contextNode; // Don't need to clone here } public override void Reset() { count = 0; } public override XPathNavigator Current { get { return contextNode; } } public override object Evaluate(XPathNodeIterator context) { contextNode = context.Current; // We don't clone here. Because we never move it. count = 0; return this; } public override XPathNavigator Advance() { if (count == 0) { count = 1; return contextNode; } return null; } public override XPathNavigator MatchNode(XPathNavigator current) { return current; } public override XPathNodeIterator Clone() { return new ContextQuery(this); } public override XPathResultType StaticType { get { return XPathResultType.NodeSet; } } public override int CurrentPosition { get { return count; } } public override int Count { get { return 1; } } public override QueryProps Properties { get { return QueryProps.Merge | QueryProps.Cached | QueryProps.Position | QueryProps.Count; } } } } // 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
- TableLayoutSettingsTypeConverter.cs
- HtmlInputSubmit.cs
- documentsequencetextview.cs
- InputLanguageEventArgs.cs
- Misc.cs
- SelectorItemAutomationPeer.cs
- PropertyExpression.cs
- MatrixStack.cs
- InvalidComObjectException.cs
- keycontainerpermission.cs
- DbCommandDefinition.cs
- DataGridViewTopLeftHeaderCell.cs
- CodeMemberEvent.cs
- AssertFilter.cs
- LocalizabilityAttribute.cs
- WeakReferenceList.cs
- ReversePositionQuery.cs
- PropertyDescriptor.cs
- DataGridDesigner.cs
- OrderablePartitioner.cs
- ListViewAutomationPeer.cs
- HwndPanningFeedback.cs
- DataBoundControl.cs
- AtomEntry.cs
- ImageAnimator.cs
- BuilderInfo.cs
- WebPartUtil.cs
- Keywords.cs
- DatePickerDateValidationErrorEventArgs.cs
- PathTooLongException.cs
- BufferBuilder.cs
- PersistenceContextEnlistment.cs
- OutKeywords.cs
- WebPartUserCapability.cs
- TypeConverterAttribute.cs
- ObjectViewFactory.cs
- KeyToListMap.cs
- TextBoxAutoCompleteSourceConverter.cs
- OLEDB_Enum.cs
- formatter.cs
- XsdValidatingReader.cs
- Brushes.cs
- PrtTicket_Base.cs
- XmlComment.cs
- clipboard.cs
- VisualBasicSettings.cs
- ResXFileRef.cs
- DBConnection.cs
- PeerInputChannel.cs
- ContractNamespaceAttribute.cs
- NameTable.cs
- RootBuilder.cs
- TextAutomationPeer.cs
- SettingsPropertyNotFoundException.cs
- ReachFixedDocumentSerializerAsync.cs
- OdbcPermission.cs
- MonthChangedEventArgs.cs
- Vector3DValueSerializer.cs
- ProgressChangedEventArgs.cs
- DynamicField.cs
- SetStateDesigner.cs
- CryptoSession.cs
- XmlSchemaObjectTable.cs
- CloudCollection.cs
- SHA384Managed.cs
- ConnectionsZoneAutoFormat.cs
- BitmapSizeOptions.cs
- ServiceProviders.cs
- HttpCapabilitiesSectionHandler.cs
- FixedTextPointer.cs
- XmlWriter.cs
- IPHostEntry.cs
- TrustLevel.cs
- SocketAddress.cs
- COM2EnumConverter.cs
- TdsParserHelperClasses.cs
- dtdvalidator.cs
- XslTransform.cs
- DbModificationClause.cs
- TextEditorSelection.cs
- NavigateEvent.cs
- CollectionViewGroupRoot.cs
- DataGridViewCellEventArgs.cs
- FolderLevelBuildProviderCollection.cs
- ColorTransform.cs
- SynchronizedDispatch.cs
- ListDictionaryInternal.cs
- CharAnimationUsingKeyFrames.cs
- XpsS0ValidatingLoader.cs
- MimeFormReflector.cs
- RegistryPermission.cs
- X509Certificate2Collection.cs
- QuaternionConverter.cs
- ToolStripLocationCancelEventArgs.cs
- ConstantCheck.cs
- ImageKeyConverter.cs
- SqlTypesSchemaImporter.cs
- DependencyPropertyConverter.cs
- EntityContainerAssociationSet.cs
- DictionaryEntry.cs