Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- Normalization.cs
- TextSpan.cs
- MultiDataTrigger.cs
- WebScriptEnablingElement.cs
- HttpRuntimeSection.cs
- DbDataSourceEnumerator.cs
- DataBinder.cs
- ProxyHwnd.cs
- XhtmlBasicCalendarAdapter.cs
- TableDetailsRow.cs
- UInt32Storage.cs
- DynamicResourceExtensionConverter.cs
- ItemDragEvent.cs
- ListItemCollection.cs
- NumberFormatInfo.cs
- ValidatorCompatibilityHelper.cs
- DecimalAnimation.cs
- NavigationWindow.cs
- DbConnectionPoolGroupProviderInfo.cs
- SoundPlayerAction.cs
- RSAOAEPKeyExchangeFormatter.cs
- PointIndependentAnimationStorage.cs
- GreenMethods.cs
- EmbossBitmapEffect.cs
- HttpListenerRequestUriBuilder.cs
- LocatorPartList.cs
- DataGridState.cs
- WmpBitmapEncoder.cs
- SqlWorkflowPersistenceService.cs
- UnknownBitmapDecoder.cs
- PrimitiveSchema.cs
- ResourceDictionaryCollection.cs
- SoapAttributes.cs
- CompilerLocalReference.cs
- MetadataSource.cs
- ComplexObject.cs
- Parameter.cs
- __TransparentProxy.cs
- AutomationPatternInfo.cs
- Track.cs
- State.cs
- PropertyItem.cs
- BidOverLoads.cs
- SerializationHelper.cs
- ActivityCollectionMarkupSerializer.cs
- CompositeScriptReferenceEventArgs.cs
- InvalidateEvent.cs
- FixedTextView.cs
- MetaModel.cs
- EventLogPermission.cs
- NullReferenceException.cs
- TypeSystem.cs
- VSWCFServiceContractGenerator.cs
- ScrollViewer.cs
- WorkflowRuntimeServiceElementCollection.cs
- SmtpLoginAuthenticationModule.cs
- CodeGenerator.cs
- X509RecipientCertificateClientElement.cs
- RowTypePropertyElement.cs
- CodePageEncoding.cs
- GuidConverter.cs
- FlowLayout.cs
- ObjectTypeMapping.cs
- FtpWebResponse.cs
- ContentValidator.cs
- CompilerError.cs
- NotSupportedException.cs
- Win32Native.cs
- ObjectHandle.cs
- KeyTime.cs
- ContextStaticAttribute.cs
- DrawingDrawingContext.cs
- TCEAdapterGenerator.cs
- DbDataAdapter.cs
- ContextDataSource.cs
- _SSPISessionCache.cs
- WindowsTitleBar.cs
- TextBlock.cs
- MimeWriter.cs
- DiagnosticsConfigurationHandler.cs
- ObjectCloneHelper.cs
- SessionPageStateSection.cs
- DescendentsWalkerBase.cs
- VoiceChangeEventArgs.cs
- ControlBindingsConverter.cs
- CookieProtection.cs
- AppSettingsExpressionEditor.cs
- HatchBrush.cs
- TCPClient.cs
- ExecutedRoutedEventArgs.cs
- BadImageFormatException.cs
- TreeViewCancelEvent.cs
- FamilyMap.cs
- ManagementDateTime.cs
- CheckBoxRenderer.cs
- FactoryRecord.cs
- SqlNodeAnnotation.cs
- XmlSchemaAll.cs
- StringPropertyBuilder.cs
- PriorityRange.cs