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
- SafeLocalMemHandle.cs
- CollectionViewProxy.cs
- ItemCollectionEditor.cs
- WindowsSolidBrush.cs
- StrongNamePublicKeyBlob.cs
- BitmapMetadataEnumerator.cs
- ToolStripItem.cs
- TextSimpleMarkerProperties.cs
- RelationHandler.cs
- SystemColors.cs
- IsolatedStorageFile.cs
- BufferedWebEventProvider.cs
- CompositeDuplexBindingElement.cs
- Events.cs
- ConstructorExpr.cs
- DiscoveryDocumentReference.cs
- DataGridViewSelectedCellsAccessibleObject.cs
- HttpProcessUtility.cs
- InlineUIContainer.cs
- LeaseManager.cs
- RemoteArgument.cs
- XmlValueConverter.cs
- Profiler.cs
- ShapingWorkspace.cs
- UpdatePanelControlTrigger.cs
- XmlILTrace.cs
- SQlBooleanStorage.cs
- SafeProcessHandle.cs
- SqlBulkCopyColumnMappingCollection.cs
- SqlExpressionNullability.cs
- ComEventsInfo.cs
- Identity.cs
- FileChangesMonitor.cs
- BooleanProjectedSlot.cs
- XmlDataSource.cs
- UriParserTemplates.cs
- CrossSiteScriptingValidation.cs
- EntityDataSourceDesigner.cs
- StrongName.cs
- SystemWebCachingSectionGroup.cs
- EntityDesignerBuildProvider.cs
- DbConnectionPoolOptions.cs
- LabelLiteral.cs
- WorkflowMessageEventArgs.cs
- AuthenticationException.cs
- Itemizer.cs
- RotateTransform.cs
- HostingPreferredMapPath.cs
- DiscoveryUtility.cs
- EarlyBoundInfo.cs
- ResXResourceWriter.cs
- BeginEvent.cs
- SqlDataReader.cs
- TransformerTypeCollection.cs
- CommandConverter.cs
- ToolStripDropDownItemDesigner.cs
- DocumentPageHost.cs
- ProxyWebPart.cs
- HashMembershipCondition.cs
- DBSqlParserTableCollection.cs
- OdbcEnvironment.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- ZipIOExtraField.cs
- TextElementCollectionHelper.cs
- LongValidatorAttribute.cs
- SchemaReference.cs
- GradientBrush.cs
- XmlSerializationGeneratedCode.cs
- MessageQueueConverter.cs
- TreeNodeStyleCollection.cs
- MaskedTextProvider.cs
- Size3D.cs
- PropertyEntry.cs
- CollectionBase.cs
- AutomationPatternInfo.cs
- ISFClipboardData.cs
- LiteralTextParser.cs
- DesignerLoader.cs
- MulticastNotSupportedException.cs
- SystemNetworkInterface.cs
- ToolStripContentPanel.cs
- TextWriterEngine.cs
- MenuItemAutomationPeer.cs
- XmlDeclaration.cs
- SystemWebExtensionsSectionGroup.cs
- SegmentInfo.cs
- TextParaClient.cs
- RolePrincipal.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- ExecutionScope.cs
- QuaternionAnimation.cs
- ConstraintEnumerator.cs
- URLMembershipCondition.cs
- ManipulationLogic.cs
- HopperCache.cs
- XmlSchemaChoice.cs
- ClientSponsor.cs
- nulltextnavigator.cs
- Point.cs
- SqlDesignerDataSourceView.cs