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
- DefaultBinder.cs
- PointLightBase.cs
- SimpleTypeResolver.cs
- RootBrowserWindow.cs
- Stacktrace.cs
- MbpInfo.cs
- CreateUserWizardStep.cs
- ReferencedType.cs
- Stack.cs
- LinkClickEvent.cs
- PreservationFileReader.cs
- XsdBuilder.cs
- ValidationRule.cs
- XamlInt32CollectionSerializer.cs
- SQLGuidStorage.cs
- PeerApplication.cs
- UIntPtr.cs
- InputLanguageManager.cs
- _DomainName.cs
- CLRBindingWorker.cs
- MultiView.cs
- DataViewManagerListItemTypeDescriptor.cs
- EditorZoneDesigner.cs
- XmlSecureResolver.cs
- ContainerControl.cs
- ParseNumbers.cs
- DataFormats.cs
- TreeNodeCollection.cs
- KeyInterop.cs
- MouseDevice.cs
- PageThemeCodeDomTreeGenerator.cs
- TransformProviderWrapper.cs
- FontDifferentiator.cs
- EditingScope.cs
- PropertyChangeTracker.cs
- DictionaryContent.cs
- CleanUpVirtualizedItemEventArgs.cs
- LocalizableAttribute.cs
- NodeLabelEditEvent.cs
- UdpDuplexChannel.cs
- RadioButtonBaseAdapter.cs
- SafeMILHandle.cs
- TrustManagerMoreInformation.cs
- LicenseManager.cs
- _ListenerResponseStream.cs
- XmlDocumentViewSchema.cs
- WindowsFormsSectionHandler.cs
- AppDomainProtocolHandler.cs
- EntitySet.cs
- ClientConfigPaths.cs
- InkSerializer.cs
- WebPartCloseVerb.cs
- CompModSwitches.cs
- RefExpr.cs
- XmlJsonWriter.cs
- SqlWriter.cs
- RijndaelManagedTransform.cs
- WebPartZoneBase.cs
- ContainerSelectorGlyph.cs
- TypeBuilder.cs
- WindowsButton.cs
- TreeNode.cs
- MyContact.cs
- BmpBitmapEncoder.cs
- FormsIdentity.cs
- DataGridState.cs
- CqlGenerator.cs
- GridViewEditEventArgs.cs
- GlyphRunDrawing.cs
- ImageCodecInfo.cs
- CompiledQuery.cs
- WebPageTraceListener.cs
- XamlReader.cs
- RandomDelaySendsAsyncResult.cs
- ComponentCollection.cs
- SettingsBase.cs
- Translator.cs
- PeerMaintainer.cs
- SR.cs
- ConfigurationElement.cs
- ipaddressinformationcollection.cs
- XmlArrayItemAttributes.cs
- RootBrowserWindowProxy.cs
- DataTableNewRowEvent.cs
- SamlSubjectStatement.cs
- DependencyPropertyAttribute.cs
- Compensation.cs
- DateTime.cs
- PartialCachingAttribute.cs
- Line.cs
- RelationshipEndCollection.cs
- RadioButtonPopupAdapter.cs
- RectAnimationClockResource.cs
- RowUpdatedEventArgs.cs
- AddressAccessDeniedException.cs
- InvalidateEvent.cs
- PreviewControlDesigner.cs
- DataFormat.cs
- DbgUtil.cs
- XmlNamespaceDeclarationsAttribute.cs