Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1 / XPathNavigatorKeyComparer.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.IO; using System.Xml.Schema; using System.Collections; using System.Diagnostics; using MS.Internal.Xml.Cache; namespace System.Xml.XPath { internal class XPathNavigatorKeyComparer : IEqualityComparer { bool IEqualityComparer.Equals( Object obj1, Object obj2 ) { XPathNavigator nav1 = obj1 as XPathNavigator; XPathNavigator nav2 = obj2 as XPathNavigator; if( ( nav1 != null ) && ( nav2 != null ) ) { if( nav1.IsSamePosition( nav2 ) ) return true; } return false; } int IEqualityComparer.GetHashCode ( Object obj ) { int hashCode; XPathNavigator nav; XPathDocumentNavigator xpdocNav; if (obj == null) { throw new ArgumentNullException("obj"); } else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) { hashCode = xpdocNav.GetPositionHashCode(); } else if( null != (nav = obj as XPathNavigator) ) { Object underlyingObject = nav.UnderlyingObject; if (underlyingObject != null) { hashCode = underlyingObject.GetHashCode(); } else { hashCode = (int)nav.NodeType; hashCode ^= nav.LocalName.GetHashCode(); hashCode ^= nav.Prefix.GetHashCode(); hashCode ^= nav.NamespaceURI.GetHashCode(); } } else { hashCode = obj.GetHashCode(); } return hashCode; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.IO; using System.Xml.Schema; using System.Collections; using System.Diagnostics; using MS.Internal.Xml.Cache; namespace System.Xml.XPath { internal class XPathNavigatorKeyComparer : IEqualityComparer { bool IEqualityComparer.Equals( Object obj1, Object obj2 ) { XPathNavigator nav1 = obj1 as XPathNavigator; XPathNavigator nav2 = obj2 as XPathNavigator; if( ( nav1 != null ) && ( nav2 != null ) ) { if( nav1.IsSamePosition( nav2 ) ) return true; } return false; } int IEqualityComparer.GetHashCode ( Object obj ) { int hashCode; XPathNavigator nav; XPathDocumentNavigator xpdocNav; if (obj == null) { throw new ArgumentNullException("obj"); } else if ( null != (xpdocNav = obj as XPathDocumentNavigator) ) { hashCode = xpdocNav.GetPositionHashCode(); } else if( null != (nav = obj as XPathNavigator) ) { Object underlyingObject = nav.UnderlyingObject; if (underlyingObject != null) { hashCode = underlyingObject.GetHashCode(); } else { hashCode = (int)nav.NodeType; hashCode ^= nav.LocalName.GetHashCode(); hashCode ^= nav.Prefix.GetHashCode(); hashCode ^= nav.NamespaceURI.GetHashCode(); } } else { hashCode = obj.GetHashCode(); } return hashCode; } } } // 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
- LowerCaseStringConverter.cs
- SoapReflectionImporter.cs
- ExpressionBinding.cs
- FunctionQuery.cs
- SerializationObjectManager.cs
- DateTimeFormatInfoScanner.cs
- UpdateTranslator.cs
- HTTPNotFoundHandler.cs
- IApplicationTrustManager.cs
- PasswordTextNavigator.cs
- DataGridViewRowEventArgs.cs
- MessageLoggingElement.cs
- NamespaceDecl.cs
- StrokeCollectionDefaultValueFactory.cs
- MarkupObject.cs
- QueryTreeBuilder.cs
- RenderOptions.cs
- TagMapInfo.cs
- DoubleAnimationUsingPath.cs
- JsonFormatWriterGenerator.cs
- ZoneLinkButton.cs
- DropShadowBitmapEffect.cs
- DataShape.cs
- SecurityContext.cs
- SignHashRequest.cs
- AssemblyHelper.cs
- HorizontalAlignConverter.cs
- HtmlInputButton.cs
- ZipIOExtraField.cs
- ProxyWebPartManagerDesigner.cs
- LinqDataSourceSelectEventArgs.cs
- QuerySetOp.cs
- _emptywebproxy.cs
- CharacterHit.cs
- TextEvent.cs
- PrintPreviewGraphics.cs
- Nullable.cs
- DataTable.cs
- AmbientValueAttribute.cs
- RulePatternOps.cs
- OutputScopeManager.cs
- ExcludePathInfo.cs
- ProviderUtil.cs
- TableRowGroup.cs
- ToolStripControlHost.cs
- ApplicationInfo.cs
- PrivateFontCollection.cs
- ISCIIEncoding.cs
- PixelShader.cs
- Matrix.cs
- CheckStoreFileValidityRequest.cs
- CompilationUtil.cs
- ColumnResizeAdorner.cs
- httpserverutility.cs
- UnsafeNativeMethods.cs
- _CacheStreams.cs
- RegexBoyerMoore.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- PropertyGrid.cs
- CreationContext.cs
- mactripleDES.cs
- PathHelper.cs
- QuaternionAnimationBase.cs
- SemaphoreSlim.cs
- SessionSymmetricTransportSecurityProtocolFactory.cs
- FilterException.cs
- SerialPinChanges.cs
- RoleService.cs
- FormViewDeleteEventArgs.cs
- ColorMatrix.cs
- SettingsAttributeDictionary.cs
- CellIdBoolean.cs
- IndexedEnumerable.cs
- GlyphRun.cs
- CurrencyWrapper.cs
- UserCancellationException.cs
- StateWorkerRequest.cs
- X509Certificate.cs
- DeviceContext2.cs
- lengthconverter.cs
- SchemaElementLookUpTable.cs
- DateTimeFormatInfoScanner.cs
- ContainerParagraph.cs
- ColorMatrix.cs
- DbSource.cs
- NativeMethods.cs
- PropertyAccessVisitor.cs
- WebBrowserUriTypeConverter.cs
- HyperLinkColumn.cs
- XmlSchemaValidator.cs
- Native.cs
- DetailsView.cs
- SmtpException.cs
- WSHttpBindingElement.cs
- HostExecutionContextManager.cs
- StaticResourceExtension.cs
- OlePropertyStructs.cs
- ChannelSinkStacks.cs
- FontSourceCollection.cs
- PointUtil.cs