Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / ContextQuery.cs / 1305376 / 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
- BaseDataListComponentEditor.cs
- DockPattern.cs
- Utils.cs
- NonVisualControlAttribute.cs
- Typography.cs
- LayoutInformation.cs
- WindowsGraphics.cs
- BindableAttribute.cs
- Compiler.cs
- EventLogger.cs
- COM2ExtendedUITypeEditor.cs
- NumericUpDown.cs
- NamespaceQuery.cs
- _UriSyntax.cs
- EdmToObjectNamespaceMap.cs
- SelectorAutomationPeer.cs
- DBConnection.cs
- SmtpDateTime.cs
- SqlCachedBuffer.cs
- util.cs
- SQLInt16Storage.cs
- RegexCaptureCollection.cs
- CapabilitiesRule.cs
- Helpers.cs
- WebControl.cs
- TextPenaltyModule.cs
- TextCollapsingProperties.cs
- ParamArrayAttribute.cs
- UnmanagedMemoryStreamWrapper.cs
- CodeExporter.cs
- CompoundFileDeflateTransform.cs
- ImageIndexConverter.cs
- HttpModuleCollection.cs
- CodeFieldReferenceExpression.cs
- EntityDataSourceChangedEventArgs.cs
- TaskFormBase.cs
- securitycriticaldataClass.cs
- _ScatterGatherBuffers.cs
- ToolStripOverflowButton.cs
- CheckBoxBaseAdapter.cs
- ObjectComplexPropertyMapping.cs
- ConfigurationErrorsException.cs
- GridItemPattern.cs
- ColorAnimation.cs
- EndEvent.cs
- HexParser.cs
- ConfigurationManagerInternalFactory.cs
- InteropTrackingRecord.cs
- Base64Decoder.cs
- PointAnimationBase.cs
- NativeWindow.cs
- XmlWellformedWriterHelpers.cs
- DataGridColumn.cs
- WizardStepBase.cs
- ContentFileHelper.cs
- dataprotectionpermission.cs
- FixedFlowMap.cs
- StandardCommands.cs
- RuntimeConfig.cs
- DefaultEventAttribute.cs
- ThousandthOfEmRealPoints.cs
- SafeTimerHandle.cs
- UpdatePanelControlTrigger.cs
- ModifiableIteratorCollection.cs
- HtmlTable.cs
- ContractMapping.cs
- SequentialActivityDesigner.cs
- XamlSerializerUtil.cs
- ImageSourceValueSerializer.cs
- SynchronizationContext.cs
- SelectionItemProviderWrapper.cs
- ValidateNames.cs
- PriorityRange.cs
- RawStylusInput.cs
- InlineCategoriesDocument.cs
- MarkupWriter.cs
- ProxyGenerationError.cs
- EventWaitHandleSecurity.cs
- TemplateBuilder.cs
- ConnectionStringsSection.cs
- Walker.cs
- TextParagraph.cs
- SqlClientFactory.cs
- Selection.cs
- CompModSwitches.cs
- BinaryCommonClasses.cs
- XpsResourceDictionary.cs
- HtmlTableCellCollection.cs
- EventInfo.cs
- ItemContainerGenerator.cs
- ClientUrlResolverWrapper.cs
- BitSet.cs
- CompiledXpathExpr.cs
- ParserContext.cs
- OleDbError.cs
- QueryExpr.cs
- Context.cs
- UnitySerializationHolder.cs
- ServiceModelConfigurationElementCollection.cs
- XhtmlBasicFormAdapter.cs