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
- StrokeCollectionDefaultValueFactory.cs
- Inflater.cs
- MultiView.cs
- Converter.cs
- URIFormatException.cs
- NotImplementedException.cs
- GregorianCalendarHelper.cs
- RecommendedAsConfigurableAttribute.cs
- HttpProfileGroupBase.cs
- MetabaseReader.cs
- CheckBox.cs
- Brush.cs
- XhtmlBasicLiteralTextAdapter.cs
- DeflateInput.cs
- DataTableCollection.cs
- DrawingCollection.cs
- OutputCacheProfile.cs
- _ContextAwareResult.cs
- Button.cs
- InternalRelationshipCollection.cs
- ComponentDispatcher.cs
- EntityDataSourceSelectedEventArgs.cs
- TableProviderWrapper.cs
- TypeDescriptor.cs
- OleAutBinder.cs
- TcpTransportSecurity.cs
- BufferedReadStream.cs
- DebugTrace.cs
- EntityConnectionStringBuilder.cs
- XamlBrushSerializer.cs
- CommonXSendMessage.cs
- FontDialog.cs
- ContentElementAutomationPeer.cs
- GPStream.cs
- dsa.cs
- SessionEndingEventArgs.cs
- DataGridViewCellStyleBuilderDialog.cs
- AssociationTypeEmitter.cs
- LicenseManager.cs
- ContextMenuAutomationPeer.cs
- Int16Animation.cs
- XmlAggregates.cs
- ConsoleEntryPoint.cs
- SQLMembershipProvider.cs
- RsaSecurityToken.cs
- StyleSelector.cs
- EventLogSession.cs
- DataRecordInternal.cs
- InnerItemCollectionView.cs
- SerializerDescriptor.cs
- ExceptionUtil.cs
- HtmlButton.cs
- KeyPullup.cs
- parserscommon.cs
- EventLogHandle.cs
- FeatureSupport.cs
- FileDocument.cs
- SigningDialog.cs
- URLString.cs
- Int64.cs
- TokenBasedSet.cs
- BlurEffect.cs
- sortedlist.cs
- MethodBuilderInstantiation.cs
- CompareInfo.cs
- XmlKeywords.cs
- XmlStringTable.cs
- UserInitiatedRoutedEventPermissionAttribute.cs
- VisualBrush.cs
- CalendarModeChangedEventArgs.cs
- SafeFileMappingHandle.cs
- ArgumentOutOfRangeException.cs
- SqlGatherProducedAliases.cs
- DefaultAssemblyResolver.cs
- ArrayList.cs
- MessagePartProtectionMode.cs
- GeneralTransformCollection.cs
- XmlCompatibilityReader.cs
- XmlDocument.cs
- EventListenerClientSide.cs
- CodeNamespace.cs
- SecurityUtils.cs
- TableParaClient.cs
- PropertyInformationCollection.cs
- QueryAccessibilityHelpEvent.cs
- XNodeNavigator.cs
- VirtualPath.cs
- BindableTemplateBuilder.cs
- DataBindingHandlerAttribute.cs
- Classification.cs
- DataTableReader.cs
- Pts.cs
- DragStartedEventArgs.cs
- SafeEventHandle.cs
- AttachmentService.cs
- HuffmanTree.cs
- DataSourceView.cs
- TextFormatter.cs
- MdiWindowListItemConverter.cs
- ClientConfigurationHost.cs