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
- EnglishPluralizationService.cs
- Icon.cs
- AutomationAttributeInfo.cs
- SqlBooleanizer.cs
- DataGridTablesFactory.cs
- HttpCookiesSection.cs
- NonParentingControl.cs
- ValueType.cs
- StringExpressionSet.cs
- NamespaceList.cs
- BufferAllocator.cs
- MessageParameterAttribute.cs
- XPathNodePointer.cs
- ServiceHostFactory.cs
- MenuTracker.cs
- ListViewItemEventArgs.cs
- Win32.cs
- RegistryHandle.cs
- SafeCryptoHandles.cs
- ServiceOperationListItem.cs
- Geometry3D.cs
- CanonicalFormWriter.cs
- Unit.cs
- DoubleCollection.cs
- DataServiceQuery.cs
- Base64Encoder.cs
- CodeAttachEventStatement.cs
- IgnoreFileBuildProvider.cs
- RenderData.cs
- AutomationElement.cs
- ProtocolsConfiguration.cs
- TextEndOfLine.cs
- DataGridViewHitTestInfo.cs
- InstanceLockedException.cs
- LambdaCompiler.cs
- ImmutableObjectAttribute.cs
- ThreadExceptionEvent.cs
- PolicyStatement.cs
- UIntPtr.cs
- X509CertificateRecipientServiceCredential.cs
- keycontainerpermission.cs
- SchemaManager.cs
- FileUtil.cs
- FirstQueryOperator.cs
- MenuItemCollectionEditor.cs
- DefaultHttpHandler.cs
- OdbcHandle.cs
- HttpRuntime.cs
- ActivityDesignerLayoutSerializers.cs
- HyperLinkDesigner.cs
- ClientFormsAuthenticationCredentials.cs
- OrderedDictionary.cs
- LookupNode.cs
- AccessorTable.cs
- IntranetCredentialPolicy.cs
- CallContext.cs
- TransformGroup.cs
- XmlElementCollection.cs
- TextEmbeddedObject.cs
- NumberFormatter.cs
- WindowsFormsHostAutomationPeer.cs
- MsmqDiagnostics.cs
- SecurityTokenTypes.cs
- List.cs
- FunctionNode.cs
- UseLicense.cs
- SettingsPropertyValue.cs
- UrlMappingCollection.cs
- ProcessManager.cs
- DescendantOverDescendantQuery.cs
- DataGridLinkButton.cs
- SelectedGridItemChangedEvent.cs
- Model3DGroup.cs
- ProtocolElementCollection.cs
- ScriptResourceAttribute.cs
- XmlSchemaAppInfo.cs
- ObjectPropertyMapping.cs
- ConfigXmlWhitespace.cs
- SoapFormatExtensions.cs
- DataControlButton.cs
- ThreadPool.cs
- Ref.cs
- RelationshipType.cs
- CompilerGeneratedAttribute.cs
- WebDisplayNameAttribute.cs
- TraceUtils.cs
- DefaultSerializationProviderAttribute.cs
- CursorConverter.cs
- NavigationProperty.cs
- ObjectDataSourceStatusEventArgs.cs
- SystemIPInterfaceStatistics.cs
- XhtmlBasicSelectionListAdapter.cs
- DelimitedListTraceListener.cs
- GlyphTypeface.cs
- StylusButtonEventArgs.cs
- TransactionContextValidator.cs
- RelationshipConverter.cs
- PropertyGridView.cs
- MultiDataTrigger.cs
- CodeCompileUnit.cs