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
- XmlSerializer.cs
- XmlSchemaObject.cs
- StrongNameKeyPair.cs
- ConfigurationSettings.cs
- TreeNodeEventArgs.cs
- ExpressionsCollectionConverter.cs
- HttpCapabilitiesBase.cs
- ExpressionNormalizer.cs
- HostExecutionContextManager.cs
- SqlRowUpdatingEvent.cs
- FormsAuthenticationCredentials.cs
- SubclassTypeValidator.cs
- ObjectStorage.cs
- EditingCoordinator.cs
- ZipFileInfo.cs
- basecomparevalidator.cs
- BaseCollection.cs
- ObjectRef.cs
- XmlElementCollection.cs
- KnownIds.cs
- PointAnimationUsingKeyFrames.cs
- SliderAutomationPeer.cs
- ConfigurationException.cs
- GreenMethods.cs
- ScrollEventArgs.cs
- EditorAttribute.cs
- TextBox.cs
- StorageMappingItemCollection.cs
- FormatterConverter.cs
- TagPrefixInfo.cs
- wgx_sdk_version.cs
- ParsedRoute.cs
- SingleKeyFrameCollection.cs
- PointConverter.cs
- SiteIdentityPermission.cs
- TraceUtils.cs
- ExceptionCollection.cs
- SecurityKeyType.cs
- EventProxy.cs
- VisualBasicExpressionConverter.cs
- TemplateNameScope.cs
- DefaultAuthorizationContext.cs
- GenericEnumerator.cs
- MenuCommand.cs
- streamingZipPartStream.cs
- DataGridBoolColumn.cs
- ExceptionTrace.cs
- ValueQuery.cs
- keycontainerpermission.cs
- InputReport.cs
- XXXInfos.cs
- DeferrableContentConverter.cs
- BypassElement.cs
- CSharpCodeProvider.cs
- ModelVisual3D.cs
- ListBoxAutomationPeer.cs
- AspNetSynchronizationContext.cs
- InputScopeNameConverter.cs
- SemanticValue.cs
- updateconfighost.cs
- CatalogZoneAutoFormat.cs
- Matrix3DConverter.cs
- DataGridLinkButton.cs
- DataTableReader.cs
- RelationshipEntry.cs
- MediaTimeline.cs
- TrackPoint.cs
- Calendar.cs
- Semaphore.cs
- OperationAbortedException.cs
- MinimizableAttributeTypeConverter.cs
- ActiveXContainer.cs
- NoneExcludedImageIndexConverter.cs
- CommandField.cs
- CodeNamespaceCollection.cs
- XmlSchemaComplexContentRestriction.cs
- SchemaSetCompiler.cs
- _NegoState.cs
- TableCellAutomationPeer.cs
- RIPEMD160.cs
- PointCollectionConverter.cs
- MenuItemAutomationPeer.cs
- FutureFactory.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CompatibleComparer.cs
- ArrayElementGridEntry.cs
- GregorianCalendarHelper.cs
- CharacterShapingProperties.cs
- DocumentOrderQuery.cs
- InputChannelBinder.cs
- TemplatePagerField.cs
- DESCryptoServiceProvider.cs
- SqlRemoveConstantOrderBy.cs
- SystemSounds.cs
- EditorServiceContext.cs
- SrgsGrammarCompiler.cs
- CodeMemberProperty.cs
- CategoryGridEntry.cs
- DataGridViewRowStateChangedEventArgs.cs
- KnownBoxes.cs