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
- SymbolUsageManager.cs
- InstanceDataCollectionCollection.cs
- ProcessStartInfo.cs
- UIElementParagraph.cs
- SystemIPInterfaceStatistics.cs
- XmlWriter.cs
- WebPartCancelEventArgs.cs
- HotSpotCollectionEditor.cs
- ListBindingConverter.cs
- MenuCommandService.cs
- CompleteWizardStep.cs
- XmlSchemaExternal.cs
- SmiMetaData.cs
- RadialGradientBrush.cs
- XmlQuerySequence.cs
- Int32Converter.cs
- SqlClientFactory.cs
- DataGridViewBand.cs
- CreateParams.cs
- RegexCharClass.cs
- CustomErrorCollection.cs
- PropertyDescriptorCollection.cs
- BooleanFacetDescriptionElement.cs
- XmlHierarchicalEnumerable.cs
- WinOEToolBoxItem.cs
- PointLightBase.cs
- HandleCollector.cs
- XmlILIndex.cs
- ClientConfigurationHost.cs
- UiaCoreProviderApi.cs
- HttpCacheParams.cs
- RoutingChannelExtension.cs
- WSFederationHttpBinding.cs
- PolyBezierSegment.cs
- SupportsPreviewControlAttribute.cs
- IdentityReference.cs
- UInt64.cs
- XMLUtil.cs
- Viewport2DVisual3D.cs
- ViewKeyConstraint.cs
- TreeChangeInfo.cs
- ResourceAttributes.cs
- FormsAuthenticationModule.cs
- DataGridViewCellValidatingEventArgs.cs
- Window.cs
- NamedPipeDuplicateContext.cs
- DataGridViewBindingCompleteEventArgs.cs
- XmlSchemaObjectCollection.cs
- TextDecorationCollection.cs
- Wizard.cs
- ConfigurationPropertyAttribute.cs
- DefinitionUpdate.cs
- HandlerMappingMemo.cs
- XmlNodeReader.cs
- X500Name.cs
- IdentifierService.cs
- AstNode.cs
- LocalFileSettingsProvider.cs
- MinimizableAttributeTypeConverter.cs
- WebPartConnectionsCloseVerb.cs
- OdbcEnvironment.cs
- ScriptServiceAttribute.cs
- ConstructorNeedsTagAttribute.cs
- SHA512Managed.cs
- HtmlInputReset.cs
- FontWeightConverter.cs
- ZoneLinkButton.cs
- Base64Encoder.cs
- Blend.cs
- NullableBoolConverter.cs
- WindowsComboBox.cs
- BypassElementCollection.cs
- HtmlFormWrapper.cs
- BasicExpressionVisitor.cs
- Graphics.cs
- StateDesigner.TransitionInfo.cs
- DefaultValueTypeConverter.cs
- IPAddress.cs
- BufferAllocator.cs
- SecurityUtils.cs
- RankException.cs
- AuthenticationConfig.cs
- VariableQuery.cs
- ToolStripDropDownClosingEventArgs.cs
- SettingsPropertyValue.cs
- MediaScriptCommandRoutedEventArgs.cs
- SizeAnimationBase.cs
- EnumMemberAttribute.cs
- SignedPkcs7.cs
- Rect3D.cs
- ProxyHelper.cs
- BidPrivateBase.cs
- ProcessModelSection.cs
- SelectionUIService.cs
- StaticTextPointer.cs
- NavigateEvent.cs
- XhtmlStyleClass.cs
- InstanceLockException.cs
- FontDriver.cs
- PenContexts.cs