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
- FontWeight.cs
- DataControlButton.cs
- XmlHelper.cs
- FileDialogCustomPlace.cs
- XpsSerializerWriter.cs
- ControlAdapter.cs
- ParagraphVisual.cs
- XmlAnyElementAttribute.cs
- SmtpMail.cs
- HttpHandlerActionCollection.cs
- RelatedEnd.cs
- XmlChoiceIdentifierAttribute.cs
- Bezier.cs
- PassportIdentity.cs
- TextRangeEdit.cs
- ControlAdapter.cs
- SchemaImporter.cs
- AssemblyHash.cs
- FilePrompt.cs
- WebPartEditVerb.cs
- EntitySetBase.cs
- BrushProxy.cs
- KeyInfo.cs
- PrintPreviewControl.cs
- JavaScriptSerializer.cs
- OptimisticConcurrencyException.cs
- IndependentAnimationStorage.cs
- DateTimeStorage.cs
- ViewStateModeByIdAttribute.cs
- DecoratedNameAttribute.cs
- FaultDescriptionCollection.cs
- HtmlButton.cs
- LoadItemsEventArgs.cs
- PluralizationServiceUtil.cs
- XMLSchema.cs
- HtmlDocument.cs
- PolicyValidationException.cs
- ConnectionInterfaceCollection.cs
- FileSecurity.cs
- HtmlWindowCollection.cs
- TrackingProfile.cs
- DataGridViewCellParsingEventArgs.cs
- UdpChannelListener.cs
- HtmlMeta.cs
- ToolStripStatusLabel.cs
- TabletDevice.cs
- Empty.cs
- LineServicesRun.cs
- BitConverter.cs
- LinkButton.cs
- ItemCollection.cs
- DiscoveryProxy.cs
- ClientViaElement.cs
- AppSettingsSection.cs
- LoginUtil.cs
- SafeNativeMethods.cs
- TextSchema.cs
- DifferencingCollection.cs
- ContainerUIElement3D.cs
- WebPartsPersonalization.cs
- NoPersistProperty.cs
- AlternateViewCollection.cs
- SpecularMaterial.cs
- GraphicsContext.cs
- XmlSchemaObjectCollection.cs
- BrushConverter.cs
- CustomAttributeFormatException.cs
- WindowsIdentity.cs
- ToolTip.cs
- EventKeyword.cs
- MachineKeySection.cs
- StateMachineHistory.cs
- SecurityContext.cs
- IconConverter.cs
- String.cs
- Command.cs
- RootProjectionNode.cs
- EndPoint.cs
- PersonalizationEntry.cs
- TimelineGroup.cs
- TTSVoice.cs
- DecryptRequest.cs
- serverconfig.cs
- SafeHandles.cs
- HttpStaticObjectsCollectionWrapper.cs
- XmlSchemaValidator.cs
- ScrollBar.cs
- ProtocolState.cs
- GridPattern.cs
- Nullable.cs
- Stack.cs
- QueryCacheEntry.cs
- SqlAliaser.cs
- ConfigurationConverterBase.cs
- ScopedKnownTypes.cs
- shaperfactoryquerycachekey.cs
- ScriptingJsonSerializationSection.cs
- RuleInfoComparer.cs
- ServiceSettingsResponseInfo.cs
- TextServicesCompartmentContext.cs