Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- DropDownList.cs
- EncryptedData.cs
- EdmValidator.cs
- ProtocolsConfigurationHandler.cs
- TabRenderer.cs
- ResourcesBuildProvider.cs
- IPGlobalProperties.cs
- StylesEditorDialog.cs
- XamlTreeBuilderBamlRecordWriter.cs
- MessageQueuePermissionAttribute.cs
- DeobfuscatingStream.cs
- WebPageTraceListener.cs
- ChildTable.cs
- HttpCookieCollection.cs
- EventLogTraceListener.cs
- GridViewSelectEventArgs.cs
- InternalConfigSettingsFactory.cs
- HtmlGenericControl.cs
- Point3DIndependentAnimationStorage.cs
- SystemException.cs
- ThreadInterruptedException.cs
- StaticSiteMapProvider.cs
- DefaultBinder.cs
- TemplatedAdorner.cs
- UnsafeNativeMethods.cs
- DependencyObjectProvider.cs
- ProfileEventArgs.cs
- DynamicPropertyHolder.cs
- PathFigure.cs
- XhtmlBasicCalendarAdapter.cs
- SrgsRuleRef.cs
- SystemEvents.cs
- ChannelAcceptor.cs
- NodeFunctions.cs
- LinearGradientBrush.cs
- ComponentEditorForm.cs
- GeneralTransform3D.cs
- SaveFileDialog.cs
- MulticastDelegate.cs
- TemplateApplicationHelper.cs
- AccessDataSourceView.cs
- SqlFormatter.cs
- EastAsianLunisolarCalendar.cs
- NativeMethods.cs
- LogReserveAndAppendState.cs
- SubMenuStyle.cs
- TemplatedMailWebEventProvider.cs
- LookupBindingPropertiesAttribute.cs
- HideDisabledControlAdapter.cs
- MessageQueueAccessControlEntry.cs
- EntitySetBaseCollection.cs
- XmlSerializationReader.cs
- MenuItemBinding.cs
- BufferModesCollection.cs
- XmlQualifiedName.cs
- OdbcFactory.cs
- SQLStringStorage.cs
- CryptoApi.cs
- ForwardPositionQuery.cs
- Domain.cs
- ExpressionParser.cs
- externdll.cs
- NetworkCredential.cs
- AssemblyAttributesGoHere.cs
- SharedPerformanceCounter.cs
- ConfigurationSection.cs
- DataConnectionHelper.cs
- TextSchema.cs
- ObjectDataSourceWizardForm.cs
- DataGridBeginningEditEventArgs.cs
- MetadataArtifactLoaderCompositeFile.cs
- FunctionOverloadResolver.cs
- DivideByZeroException.cs
- SpinLock.cs
- LongValidator.cs
- DefaultBinder.cs
- CompilerCollection.cs
- StatusBarPanel.cs
- Drawing.cs
- TdsEnums.cs
- IIS7UserPrincipal.cs
- DataGridViewIntLinkedList.cs
- PolicyException.cs
- MetadataArtifactLoaderComposite.cs
- ResourceCodeDomSerializer.cs
- ValueTypeFixupInfo.cs
- ReadWriteObjectLock.cs
- DataGridHeaderBorder.cs
- FormViewUpdatedEventArgs.cs
- ObjectDisposedException.cs
- PeerCollaborationPermission.cs
- SoapInteropTypes.cs
- DesignerCategoryAttribute.cs
- ExpressionBindingsDialog.cs
- WebPartManagerInternals.cs
- RoleGroupCollectionEditor.cs
- MultilineStringConverter.cs
- XpsFilter.cs
- XmlWrappingWriter.cs
- FileNotFoundException.cs