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
- UnauthorizedWebPart.cs
- SelectionItemPatternIdentifiers.cs
- KeyMatchBuilder.cs
- SslStream.cs
- SmtpAuthenticationManager.cs
- FileUtil.cs
- WSMessageEncoding.cs
- TextDecoration.cs
- ThemeableAttribute.cs
- AccessDataSourceWizardForm.cs
- mediaeventshelper.cs
- HTMLTextWriter.cs
- MasterPageBuildProvider.cs
- UIElementParagraph.cs
- PropertyEmitterBase.cs
- DataGridViewToolTip.cs
- UrlPath.cs
- DataGridCellAutomationPeer.cs
- TargetControlTypeCache.cs
- DBSchemaRow.cs
- BlobPersonalizationState.cs
- TraceContextRecord.cs
- WSDualHttpBindingCollectionElement.cs
- NavigationProgressEventArgs.cs
- HWStack.cs
- CombinedGeometry.cs
- PublisherIdentityPermission.cs
- ListViewTableCell.cs
- ImplicitInputBrush.cs
- ScriptingRoleServiceSection.cs
- BinaryObjectReader.cs
- WasEndpointConfigContainer.cs
- BindingValueChangedEventArgs.cs
- DbProviderManifest.cs
- SqlDataSourceSelectingEventArgs.cs
- WindowsRegion.cs
- EventLogger.cs
- CapabilitiesAssignment.cs
- HttpListenerRequest.cs
- XhtmlBasicControlAdapter.cs
- DataFieldCollectionEditor.cs
- QueryContinueDragEvent.cs
- SHA384.cs
- SByte.cs
- compensatingcollection.cs
- GuidelineCollection.cs
- ExtensibleClassFactory.cs
- KeyTime.cs
- Bits.cs
- XmlUrlResolver.cs
- TrackBar.cs
- TreeViewEvent.cs
- InfoCardHelper.cs
- HtmlToClrEventProxy.cs
- WpfXamlMember.cs
- GlobalProxySelection.cs
- GeneralTransform3DGroup.cs
- FrameworkEventSource.cs
- _BaseOverlappedAsyncResult.cs
- ListBindableAttribute.cs
- WindowsPrincipal.cs
- TheQuery.cs
- MultiSelectRootGridEntry.cs
- CombinedTcpChannel.cs
- CollectionTraceRecord.cs
- ContentValidator.cs
- InvokePatternIdentifiers.cs
- CacheModeConverter.cs
- CuspData.cs
- PrefixQName.cs
- SectionXmlInfo.cs
- Trigger.cs
- BaseConfigurationRecord.cs
- Matrix3DValueSerializer.cs
- StrokeSerializer.cs
- XpsFilter.cs
- ColorContextHelper.cs
- SqlDependency.cs
- TrimSurroundingWhitespaceAttribute.cs
- DecoderReplacementFallback.cs
- OracleParameterCollection.cs
- SocketInformation.cs
- DbMetaDataFactory.cs
- XPathException.cs
- TextDataBindingHandler.cs
- Enlistment.cs
- BulletChrome.cs
- Object.cs
- NoneExcludedImageIndexConverter.cs
- Gdiplus.cs
- WorkflowDesignerMessageFilter.cs
- ResourcesGenerator.cs
- FormViewRow.cs
- DependencyPropertyAttribute.cs
- IncrementalCompileAnalyzer.cs
- MetadataAssemblyHelper.cs
- TcpClientSocketManager.cs
- TTSVoice.cs
- WorkflowServiceNamespace.cs
- SqlMethodAttribute.cs