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
- DesignerTextBoxAdapter.cs
- DbParameterCollection.cs
- SchemaNotation.cs
- HttpRequest.cs
- EdmToObjectNamespaceMap.cs
- XhtmlBasicLabelAdapter.cs
- ReaderContextStackData.cs
- StreamInfo.cs
- WeakRefEnumerator.cs
- XD.cs
- SHA1CryptoServiceProvider.cs
- XmlSerializationGeneratedCode.cs
- ServicePoint.cs
- ObfuscateAssemblyAttribute.cs
- DesignerActionItemCollection.cs
- HtmlTable.cs
- CmsUtils.cs
- IisTraceWebEventProvider.cs
- VirtualPathProvider.cs
- XmlSchemaValidator.cs
- TcpPortSharing.cs
- TableCellCollection.cs
- PermissionListSet.cs
- CustomExpression.cs
- WebZone.cs
- DesignerTransactionCloseEvent.cs
- NetworkStream.cs
- StagingAreaInputItem.cs
- WinInetCache.cs
- System.Data_BID.cs
- WebServiceFault.cs
- WebControlAdapter.cs
- ApplicationServiceManager.cs
- PolicyException.cs
- EntityDesignerDataSourceView.cs
- ActiveXSite.cs
- IntSecurity.cs
- DataGridViewMethods.cs
- WebPartConnectionsCancelEventArgs.cs
- LoginStatusDesigner.cs
- XmlMembersMapping.cs
- GeometryConverter.cs
- DiscoveryClientReferences.cs
- ComboBoxItem.cs
- Function.cs
- XsltSettings.cs
- DesignerDataStoredProcedure.cs
- SchemaCollectionCompiler.cs
- CryptoApi.cs
- ToolStripPanelRenderEventArgs.cs
- URI.cs
- QilValidationVisitor.cs
- SoapFault.cs
- DoubleKeyFrameCollection.cs
- MapPathBasedVirtualPathProvider.cs
- log.cs
- EnumerableWrapperWeakToStrong.cs
- Size3D.cs
- EditorPartChrome.cs
- SspiNegotiationTokenProviderState.cs
- DataControlFieldCollection.cs
- InternalCompensate.cs
- XmlSerializer.cs
- EventDescriptorCollection.cs
- DataRowChangeEvent.cs
- ApplicationBuildProvider.cs
- AlternationConverter.cs
- PreservationFileWriter.cs
- WindowsUpDown.cs
- ScopelessEnumAttribute.cs
- ZipPackage.cs
- ElementNotEnabledException.cs
- WorkflowNamespace.cs
- SymbolDocumentInfo.cs
- RelationshipEnd.cs
- DocumentReferenceCollection.cs
- PropertyItem.cs
- WebContext.cs
- EntityDataSourceWrapperCollection.cs
- WinFormsComponentEditor.cs
- Knowncolors.cs
- DataGridViewRowsAddedEventArgs.cs
- ImmutableObjectAttribute.cs
- AssemblyEvidenceFactory.cs
- HtmlInputCheckBox.cs
- XmlSchemaAttributeGroupRef.cs
- NavigationEventArgs.cs
- UDPClient.cs
- CompareInfo.cs
- DataBoundControlAdapter.cs
- BitVector32.cs
- WebResourceUtil.cs
- FileVersionInfo.cs
- FastEncoderWindow.cs
- ServicePointManagerElement.cs
- StatusBar.cs
- SafeNativeMethodsOther.cs
- DragDrop.cs
- _SslStream.cs
- RequestCache.cs