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
- ToolboxBitmapAttribute.cs
- StyleTypedPropertyAttribute.cs
- NetSectionGroup.cs
- PartialCachingAttribute.cs
- SecUtil.cs
- ComponentResourceManager.cs
- ByValueEqualityComparer.cs
- StopStoryboard.cs
- XslAstAnalyzer.cs
- XPathNavigator.cs
- DBParameter.cs
- FunctionQuery.cs
- Gdiplus.cs
- ButtonColumn.cs
- StylusPointProperty.cs
- QuadraticBezierSegment.cs
- ProxyDataContractResolver.cs
- EnumerableValidator.cs
- Selector.cs
- BreakRecordTable.cs
- TrackingMemoryStreamFactory.cs
- Boolean.cs
- XmlSchemaDocumentation.cs
- SiteOfOriginContainer.cs
- Subset.cs
- SlipBehavior.cs
- MissingFieldException.cs
- RightsManagementErrorHandler.cs
- MultiBindingExpression.cs
- webeventbuffer.cs
- PagePropertiesChangingEventArgs.cs
- Page.cs
- TypeExtension.cs
- AuthorizationRule.cs
- OleDbFactory.cs
- MetadataSerializer.cs
- Size.cs
- DataGridViewCellValueEventArgs.cs
- QueryCorrelationInitializer.cs
- NonClientArea.cs
- AuthenticateEventArgs.cs
- UInt32Converter.cs
- SafeEventLogReadHandle.cs
- DataGridViewDataConnection.cs
- WindowsStartMenu.cs
- PowerModeChangedEventArgs.cs
- TextEvent.cs
- ISessionStateStore.cs
- ChangeNode.cs
- ToolStripStatusLabel.cs
- DocumentXmlWriter.cs
- ArraySegment.cs
- DesignerDataStoredProcedure.cs
- WebControlsSection.cs
- SqlDataAdapter.cs
- Set.cs
- TextSerializer.cs
- ToolboxItemCollection.cs
- PackageFilter.cs
- ReflectPropertyDescriptor.cs
- SqlHelper.cs
- TreeSet.cs
- TriState.cs
- KeyTime.cs
- ConfigXmlText.cs
- ImageField.cs
- ApplicationId.cs
- MailWebEventProvider.cs
- MonthCalendarDesigner.cs
- LongMinMaxAggregationOperator.cs
- AnimatedTypeHelpers.cs
- ScrollBar.cs
- updatecommandorderer.cs
- AvTraceDetails.cs
- RandomNumberGenerator.cs
- EdmToObjectNamespaceMap.cs
- SystemTcpConnection.cs
- RequestQueryParser.cs
- DesignerAutoFormatCollection.cs
- SystemResourceHost.cs
- SelectionChangedEventArgs.cs
- CustomTypeDescriptor.cs
- Substitution.cs
- NotFiniteNumberException.cs
- MsmqIntegrationMessagePool.cs
- SingleAnimation.cs
- RegexFCD.cs
- DropSource.cs
- OracleCommand.cs
- CqlQuery.cs
- WebSysDisplayNameAttribute.cs
- DataGridViewRowsAddedEventArgs.cs
- XmlSchemaGroup.cs
- DataTableTypeConverter.cs
- ConfigXmlElement.cs
- BStrWrapper.cs
- ToolStripControlHost.cs
- ContainerParaClient.cs
- GenericXmlSecurityToken.cs
- MetadataCollection.cs