Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1305376 / 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
- DllHostedComPlusServiceHost.cs
- HighlightVisual.cs
- DesignerValidationSummaryAdapter.cs
- DispatcherFrame.cs
- TypeForwardedToAttribute.cs
- CryptoApi.cs
- SecurityRuntime.cs
- XmlAttributeProperties.cs
- SigningCredentials.cs
- DiagnosticsConfigurationHandler.cs
- ArraySortHelper.cs
- DecimalStorage.cs
- PropertyDescriptors.cs
- BrowserTree.cs
- _SpnDictionary.cs
- ServerType.cs
- CompletionBookmark.cs
- RepeatBehavior.cs
- ReachSerializableProperties.cs
- DataGridViewIntLinkedList.cs
- PeerCollaboration.cs
- BamlRecordHelper.cs
- UnlockCardRequest.cs
- ComPlusTypeValidator.cs
- SQLString.cs
- WindowsGraphicsCacheManager.cs
- hresults.cs
- MouseEventArgs.cs
- CapacityStreamGeometryContext.cs
- LinqExpressionNormalizer.cs
- CommandManager.cs
- BitmapEffectInputData.cs
- CommandManager.cs
- CompositionAdorner.cs
- NavigateEvent.cs
- NodeFunctions.cs
- MetaDataInfo.cs
- RestClientProxyHandler.cs
- SqlDataSourceDesigner.cs
- XamlPointCollectionSerializer.cs
- controlskin.cs
- DataGridViewColumnConverter.cs
- GlobalAllocSafeHandle.cs
- StateDesigner.Layouts.cs
- WebBrowserNavigatingEventHandler.cs
- BaseResourcesBuildProvider.cs
- selecteditemcollection.cs
- PropertyChangedEventManager.cs
- OdbcError.cs
- XmlDeclaration.cs
- Hex.cs
- ToolStripItemClickedEventArgs.cs
- DbModificationClause.cs
- PagesSection.cs
- WMIGenerator.cs
- ItemType.cs
- ScrollData.cs
- Memoizer.cs
- FacetDescriptionElement.cs
- Translator.cs
- TableStyle.cs
- ConfigurationManagerHelperFactory.cs
- TileModeValidation.cs
- WebPartTransformerAttribute.cs
- SpinLock.cs
- SafeLocalAllocation.cs
- QilList.cs
- TextTreeDeleteContentUndoUnit.cs
- MemoryMappedView.cs
- TheQuery.cs
- XmlSchemaComplexContentExtension.cs
- QilTypeChecker.cs
- KoreanLunisolarCalendar.cs
- SamlConstants.cs
- TraceContextEventArgs.cs
- RotateTransform.cs
- MetadataItemEmitter.cs
- TypeCodeDomSerializer.cs
- StateElement.cs
- DocumentPage.cs
- PasswordRecovery.cs
- WebBrowserPermission.cs
- MultipartIdentifier.cs
- XmlnsDictionary.cs
- TraceLog.cs
- RSAPKCS1SignatureFormatter.cs
- ConstNode.cs
- AppSettingsExpressionBuilder.cs
- cryptoapiTransform.cs
- ObjectMemberMapping.cs
- PackWebResponse.cs
- CanonicalizationDriver.cs
- RegisteredHiddenField.cs
- SqlRowUpdatedEvent.cs
- XmlDataSource.cs
- MailWebEventProvider.cs
- ErrorFormatterPage.cs
- TempFiles.cs
- ZipPackage.cs
- TraceInternal.cs