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
- MessageProperties.cs
- HashUtility.cs
- X509CertificateStore.cs
- ISFClipboardData.cs
- CombinedGeometry.cs
- QueryConverter.cs
- XmlUrlEditor.cs
- IPipelineRuntime.cs
- safesecurityhelperavalon.cs
- ObjectIDGenerator.cs
- RowToFieldTransformer.cs
- AdornerDecorator.cs
- CategoryAttribute.cs
- CompiledXpathExpr.cs
- DataSourceIDConverter.cs
- RepeatButton.cs
- WebControlsSection.cs
- sqlstateclientmanager.cs
- LocatorGroup.cs
- FileLogRecordHeader.cs
- ContextMenu.cs
- SymmetricKeyWrap.cs
- ToolStripDropTargetManager.cs
- TextMarkerSource.cs
- HttpRequestCacheValidator.cs
- StringBuilder.cs
- RegionData.cs
- FormViewUpdatedEventArgs.cs
- ApplicationActivator.cs
- PointAnimationClockResource.cs
- AggregateNode.cs
- SymbolType.cs
- StringDictionaryCodeDomSerializer.cs
- HotSpot.cs
- DrawListViewItemEventArgs.cs
- RegularExpressionValidator.cs
- TypeExtensionSerializer.cs
- MemoryFailPoint.cs
- SessionParameter.cs
- ClickablePoint.cs
- ManagementScope.cs
- SecurityHelper.cs
- MemberDescriptor.cs
- HandoffBehavior.cs
- AmbientProperties.cs
- DateTimeFormat.cs
- SocketManager.cs
- UnsafeNativeMethods.cs
- ReversePositionQuery.cs
- XmlLangPropertyAttribute.cs
- XamlParser.cs
- LinqDataSourceStatusEventArgs.cs
- HtmlInputButton.cs
- ParameterModifier.cs
- DataServices.cs
- DBCSCodePageEncoding.cs
- SqlDataRecord.cs
- WebPartDescriptionCollection.cs
- WindowsAltTab.cs
- BasicBrowserDialog.designer.cs
- UserControl.cs
- DesignerSerializerAttribute.cs
- TransformedBitmap.cs
- Clause.cs
- NameSpaceEvent.cs
- OdbcConnectionStringbuilder.cs
- VoiceSynthesis.cs
- KeyEventArgs.cs
- XmlAttributeProperties.cs
- FileNameEditor.cs
- TextAction.cs
- unsafenativemethodsother.cs
- DataKeyArray.cs
- JpegBitmapDecoder.cs
- XmlAtomicValue.cs
- ExpressionVisitorHelpers.cs
- BaseDataList.cs
- TPLETWProvider.cs
- StdRegProviderWrapper.cs
- BaseCodeDomTreeGenerator.cs
- Rect3DConverter.cs
- CapabilitiesState.cs
- InfoCardHelper.cs
- SamlAttributeStatement.cs
- TransformationRules.cs
- XPathDocumentNavigator.cs
- ComponentSerializationService.cs
- MorphHelper.cs
- ProxyGenerator.cs
- ModelTreeEnumerator.cs
- _Connection.cs
- TextBreakpoint.cs
- RijndaelCryptoServiceProvider.cs
- XmlDictionaryString.cs
- IsolatedStorageFile.cs
- SpotLight.cs
- ReferencedCollectionType.cs
- CopyAction.cs
- OrderedDictionaryStateHelper.cs
- TextProperties.cs