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
- DbParameterHelper.cs
- StyleSheetDesigner.cs
- QilLiteral.cs
- SqlBinder.cs
- NewItemsContextMenuStrip.cs
- HttpBufferlessInputStream.cs
- XmlWrappingWriter.cs
- PropertyMetadata.cs
- EntityDataSourceQueryBuilder.cs
- UndoManager.cs
- PenContext.cs
- BufferModeSettings.cs
- DataGridViewColumnTypePicker.cs
- DataGridCell.cs
- InheritedPropertyDescriptor.cs
- WaitForChangedResult.cs
- FillErrorEventArgs.cs
- BindingUtils.cs
- autovalidator.cs
- AllMembershipCondition.cs
- HMACMD5.cs
- DictionaryCustomTypeDescriptor.cs
- SID.cs
- PeerCollaboration.cs
- EventProviderClassic.cs
- PagesChangedEventArgs.cs
- BamlBinaryWriter.cs
- StrokeSerializer.cs
- ComponentResourceManager.cs
- XmlParserContext.cs
- AssociationProvider.cs
- XamlParser.cs
- BrowserCapabilitiesFactory.cs
- CategoryNameCollection.cs
- Walker.cs
- SelectedDatesCollection.cs
- SdlChannelSink.cs
- CryptoKeySecurity.cs
- PageBuildProvider.cs
- ActiveXSite.cs
- HostingEnvironmentException.cs
- PageMediaType.cs
- PageContent.cs
- LinqDataSourceSelectEventArgs.cs
- Expressions.cs
- TogglePattern.cs
- SystemNetworkInterface.cs
- Module.cs
- ReaderWriterLockSlim.cs
- TemplateModeChangedEventArgs.cs
- CompositeDispatchFormatter.cs
- BitmapMetadata.cs
- FixedSchema.cs
- PersonalizationStateInfo.cs
- ConstructorBuilder.cs
- CryptoApi.cs
- ConfigurationValidatorAttribute.cs
- GroupBox.cs
- SmiEventSink_DeferedProcessing.cs
- CounterSetInstanceCounterDataSet.cs
- ListBindableAttribute.cs
- coordinatorfactory.cs
- Animatable.cs
- ColorPalette.cs
- SortDescription.cs
- WebBrowserProgressChangedEventHandler.cs
- InternalConfigEventArgs.cs
- EnumerableValidator.cs
- NavigationFailedEventArgs.cs
- RsaSecurityTokenAuthenticator.cs
- ByteStack.cs
- InvokeMethod.cs
- LocatorPartList.cs
- EditorAttribute.cs
- ILGenerator.cs
- PhysicalFontFamily.cs
- ThreadStartException.cs
- DataSysAttribute.cs
- DataPagerFieldCommandEventArgs.cs
- XmlValidatingReader.cs
- XmlQueryStaticData.cs
- XPathQilFactory.cs
- StrongTypingException.cs
- CompressStream.cs
- TimeZone.cs
- SchemaName.cs
- SecurityTokenValidationException.cs
- InvalidPropValue.cs
- ProxyHwnd.cs
- mediaeventshelper.cs
- EmptyReadOnlyDictionaryInternal.cs
- ConfigXmlCDataSection.cs
- ZipIOExtraFieldElement.cs
- KeyGestureValueSerializer.cs
- _TimerThread.cs
- CodeFieldReferenceExpression.cs
- WebPartTransformerAttribute.cs
- EnumValAlphaComparer.cs
- DataGridViewColumnEventArgs.cs
- FixedStringLookup.cs