Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- PinnedBufferMemoryStream.cs
- VisualTreeHelper.cs
- MergeLocalizationDirectives.cs
- HandlerBase.cs
- TextEditorTyping.cs
- GenerateTemporaryTargetAssembly.cs
- DbConnectionPoolCounters.cs
- SmtpCommands.cs
- TCPClient.cs
- ArraySortHelper.cs
- GlyphRunDrawing.cs
- OrthographicCamera.cs
- MachineKeyConverter.cs
- Soap12FormatExtensions.cs
- AuthenticationException.cs
- SelfIssuedAuthRSACryptoProvider.cs
- QfeChecker.cs
- XmlILOptimizerVisitor.cs
- TreeViewDesigner.cs
- SecureStringHasher.cs
- GenericEnumConverter.cs
- XmlMembersMapping.cs
- SystemException.cs
- ObjectCache.cs
- PenThreadPool.cs
- XmlArrayItemAttribute.cs
- CommandHelpers.cs
- ReflectionTypeLoadException.cs
- EnterpriseServicesHelper.cs
- GrammarBuilderDictation.cs
- OrderablePartitioner.cs
- DesignTimeParseData.cs
- TextProperties.cs
- RegisteredExpandoAttribute.cs
- ExtractorMetadata.cs
- LicenseException.cs
- ByteStack.cs
- LoginCancelEventArgs.cs
- DataTableReader.cs
- XamlFxTrace.cs
- AsymmetricSignatureDeformatter.cs
- SecUtil.cs
- XsltConvert.cs
- DataPager.cs
- AuthenticationService.cs
- VisualStyleInformation.cs
- MessageEncoder.cs
- CopyNamespacesAction.cs
- HttpWebRequest.cs
- IssuanceLicense.cs
- HttpModuleAction.cs
- TableItemPattern.cs
- BamlBinaryReader.cs
- HttpListenerContext.cs
- XPathNavigator.cs
- DashStyle.cs
- WebServiceClientProxyGenerator.cs
- DataGridViewCellStyle.cs
- JobInputBins.cs
- LinearGradientBrush.cs
- SchemaTypeEmitter.cs
- RegexMatch.cs
- WebBrowserEvent.cs
- RepeatInfo.cs
- TextViewSelectionProcessor.cs
- unsafeIndexingFilterStream.cs
- BinaryFormatter.cs
- IgnoreSectionHandler.cs
- AndAlso.cs
- PersistChildrenAttribute.cs
- TimeoutException.cs
- Light.cs
- ElementUtil.cs
- wgx_render.cs
- ZipIOFileItemStream.cs
- ListControlDataBindingHandler.cs
- SettingsPropertyNotFoundException.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- AsyncCompletedEventArgs.cs
- XmlnsDictionary.cs
- InternalBufferOverflowException.cs
- XmlBinaryWriterSession.cs
- CompositeFontParser.cs
- SafeMemoryMappedViewHandle.cs
- AbsoluteQuery.cs
- UInt16.cs
- XmlSchemaAnnotated.cs
- ExtentKey.cs
- CodeTypeReferenceCollection.cs
- SafeRegistryHandle.cs
- EntityContainerRelationshipSet.cs
- Preprocessor.cs
- SystemFonts.cs
- AuthenticationService.cs
- MethodBuilder.cs
- SerializationObjectManager.cs
- EmbossBitmapEffect.cs
- DynamicDiscoveryDocument.cs
- PopOutPanel.cs
- ObjectStateEntry.cs