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
- SqlDependency.cs
- ObjectStateEntryDbDataRecord.cs
- InfoCardTrace.cs
- ListDictionaryInternal.cs
- StylusEditingBehavior.cs
- DynamicControl.cs
- DynamicFilter.cs
- ExceptionHandler.cs
- SuppressIldasmAttribute.cs
- InvalidDocumentContentsException.cs
- DiscoveryVersion.cs
- SystemBrushes.cs
- IconConverter.cs
- CodeBinaryOperatorExpression.cs
- oledbconnectionstring.cs
- DetailsViewDeletedEventArgs.cs
- PostBackTrigger.cs
- SyntaxCheck.cs
- ECDiffieHellmanPublicKey.cs
- HttpApplicationFactory.cs
- MessageFormatterConverter.cs
- CodeCompileUnit.cs
- RankException.cs
- BoolExpr.cs
- GreenMethods.cs
- XmlSchemaChoice.cs
- OracleConnection.cs
- DiscoveryServerProtocol.cs
- ClosableStream.cs
- Events.cs
- WorkflowMarkupSerializationManager.cs
- ToolStripDropDownButton.cs
- _CookieModule.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- StateBag.cs
- RepeaterItem.cs
- QilInvokeEarlyBound.cs
- CodeAccessPermission.cs
- _RegBlobWebProxyDataBuilder.cs
- TransactionException.cs
- X509WindowsSecurityToken.cs
- DSACryptoServiceProvider.cs
- FileSystemWatcher.cs
- FileClassifier.cs
- PolicyAssertionCollection.cs
- LineBreakRecord.cs
- KeyboardEventArgs.cs
- documentsequencetextpointer.cs
- MemoryResponseElement.cs
- basecomparevalidator.cs
- ValidationHelper.cs
- ResolveNameEventArgs.cs
- DeclaredTypeElementCollection.cs
- NotImplementedException.cs
- RotateTransform.cs
- ActionFrame.cs
- Compiler.cs
- Codec.cs
- WebPartRestoreVerb.cs
- TemplateBuilder.cs
- XsltException.cs
- PropertyGridEditorPart.cs
- NavigateEvent.cs
- DefaultProxySection.cs
- SudsWriter.cs
- LowerCaseStringConverter.cs
- InputLanguageEventArgs.cs
- ImageFormat.cs
- AuthStoreRoleProvider.cs
- BinaryParser.cs
- MessageLoggingElement.cs
- ObjectViewFactory.cs
- OracleTransaction.cs
- MailSettingsSection.cs
- DbConnectionStringCommon.cs
- GradientStopCollection.cs
- RectAnimationClockResource.cs
- AsyncDataRequest.cs
- XmlLinkedNode.cs
- SqlSupersetValidator.cs
- SQLString.cs
- UntrustedRecipientException.cs
- HyperLinkField.cs
- DataGridViewCellStyleChangedEventArgs.cs
- BCryptHashAlgorithm.cs
- XmlSchemaAttributeGroupRef.cs
- BamlReader.cs
- TableColumn.cs
- InternalTypeHelper.cs
- LOSFormatter.cs
- QueryExpr.cs
- DataGridViewSortCompareEventArgs.cs
- XmlDocumentFragment.cs
- PageContentAsyncResult.cs
- SecurityException.cs
- WindowPattern.cs
- JoinTreeSlot.cs
- CommunicationException.cs
- Point.cs
- DbParameterCollectionHelper.cs