Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / XPathNavigatorKeyComparer.cs / 1305376 / 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
- BaseValidator.cs
- InheritedPropertyChangedEventArgs.cs
- WebPartZoneCollection.cs
- WebPageTraceListener.cs
- RegionIterator.cs
- XmlReader.cs
- Thread.cs
- SqlBuffer.cs
- UserNameSecurityTokenAuthenticator.cs
- StateMachineWorkflowDesigner.cs
- TypeForwardedToAttribute.cs
- DoubleAnimationClockResource.cs
- HostingEnvironmentException.cs
- GroupBox.cs
- EtwTrace.cs
- XPathConvert.cs
- Soap12ProtocolReflector.cs
- InfoCardClaim.cs
- Matrix3DConverter.cs
- DocumentPageViewAutomationPeer.cs
- ComPlusInstanceContextInitializer.cs
- CellParaClient.cs
- BoundPropertyEntry.cs
- IOException.cs
- RuntimeConfig.cs
- Parser.cs
- Paragraph.cs
- TraceSource.cs
- XmlSchemas.cs
- SamlAuthorizationDecisionClaimResource.cs
- HyperLinkField.cs
- SymLanguageVendor.cs
- StreamGeometry.cs
- TemporaryBitmapFile.cs
- VerificationAttribute.cs
- StorageTypeMapping.cs
- KeyPullup.cs
- ToolBarButtonClickEvent.cs
- TextSerializer.cs
- UIPermission.cs
- BamlResourceContent.cs
- ConfigurationElement.cs
- Debugger.cs
- DocumentReference.cs
- TemplateGroupCollection.cs
- XmlSchemaSimpleContentRestriction.cs
- SiteMapProvider.cs
- TreeNodeClickEventArgs.cs
- SqlDelegatedTransaction.cs
- SqlDataSourceView.cs
- PaintValueEventArgs.cs
- MissingMemberException.cs
- MailSettingsSection.cs
- WebPartCloseVerb.cs
- LoggedException.cs
- FlowDocument.cs
- DataBinder.cs
- CodeDefaultValueExpression.cs
- XmlEntity.cs
- Rect.cs
- LocalFileSettingsProvider.cs
- WebPartConnectionsCloseVerb.cs
- NativeMethods.cs
- DSGeneratorProblem.cs
- DataPagerCommandEventArgs.cs
- HttpRawResponse.cs
- TargetPerspective.cs
- AssociationType.cs
- TypedReference.cs
- EntityDataSourceDesigner.cs
- BridgeDataRecord.cs
- TabletDevice.cs
- MarginCollapsingState.cs
- TreeNodeCollection.cs
- NativeMethods.cs
- AutoResetEvent.cs
- hresults.cs
- ExtensionFile.cs
- RecordConverter.cs
- XmlElement.cs
- CombinedHttpChannel.cs
- Hex.cs
- HyperLinkColumn.cs
- ActionFrame.cs
- TemplateColumn.cs
- CodeCatchClause.cs
- CompilerGlobalScopeAttribute.cs
- DataIdProcessor.cs
- CodeRegionDirective.cs
- XomlCompilerHelpers.cs
- GradientStop.cs
- ErrorFormatter.cs
- CaseCqlBlock.cs
- ServiceDescriptionImporter.cs
- TimeZone.cs
- ListBoxItemAutomationPeer.cs
- TargetException.cs
- RSAOAEPKeyExchangeFormatter.cs
- HandlerBase.cs
- OleDbFactory.cs